Linux makefile updates for DSP Client example using IPC to communicate to Linux RM...
authorJustin Sobota <jsobota@ti.com>
Fri, 17 May 2013 15:58:09 +0000 (11:58 -0400)
committerJustin Sobota <jsobota@ti.com>
Fri, 17 May 2013 15:58:09 +0000 (11:58 -0400)
15 files changed:
makefile_armv7
test/k2h/armv7/linux/build/makefile
test/k2h/armv7/linux/dspClientTest/dsp_client.c [new file with mode: 0644]
test/k2h/armv7/linux/dspClientTest/dsp_client.cfg [new file with mode: 0644]
test/k2h/armv7/linux/dspClientTest/dsp_client.cfg.xs [new file with mode: 0644]
test/k2h/armv7/linux/rm_dsp_client_test.c [new file with mode: 0644]
test/k2h/armv7/linux/rm_linux_client_test.c
test/k2h/c66/bios/rmK2HArmv7LinuxDspClientTestProject.txt [new file with mode: 0644]
test/k2k/armv7/linux/build/makefile
test/k2k/armv7/linux/dspClientTest/dsp_client.c [new file with mode: 0644]
test/k2k/armv7/linux/dspClientTest/dsp_client.cfg [new file with mode: 0644]
test/k2k/armv7/linux/dspClientTest/dsp_client.cfg.xs [new file with mode: 0644]
test/k2k/armv7/linux/rm_dsp_client_test.c [new file with mode: 0644]
test/k2k/armv7/linux/rm_linux_client_test.c
test/k2k/c66/bios/rmK2KArmv7LinuxDspClientTestProject.txt [new file with mode: 0644]

index 50594d85c42c2be89c8976e23f381b0d977c2bde..eeb47ac8edc631e5ccb842febb0f9c0d0cc1de25 100644 (file)
@@ -82,7 +82,8 @@ clean:
 installbin:
        install -d $(INSTALL_BIN_BASE_DIR)
        install -c -m 755 $(ARMV7BINDIR)/rm/test/rmServer.out    $(INSTALL_BIN_BASE_DIR)/rmServer_$(DEVICE).out
-       install -c -m 755 $(ARMV7BINDIR)/rm/test/rmClientTest.out    $(INSTALL_BIN_BASE_DIR)/rmClientTest_$(DEVICE).out
+       install -c -m 755 $(ARMV7BINDIR)/rm/test/rmLinuxClientTest.out    $(INSTALL_BIN_BASE_DIR)/rmLinuxClientTest_$(DEVICE).out
+       install -c -m 755 $(ARMV7BINDIR)/rm/test/rmDspClientTest.out    $(INSTALL_BIN_BASE_DIR)/rmDspClientTest_$(DEVICE).out   
 
 install:
        install -d $(INSTALL_INC_BASE_DIR)/ti/drv/rm/include
index 5c569dd72511d46955f7c7776331a068e0c18d40..bf7d965870011429a38b01ad8705f5fb446ee35f 100644 (file)
@@ -6,6 +6,9 @@ empty =
 space =$(empty) $(empty)
 
 PDK_INSTALL_PATH ?= ../../..
+# IPC_DEVKIT_INSTALL_PATH ?= need/to/set/path
+# export IPC_DEVKIT_INSTALL_PATH if IPC is not in /usr/lib
+# Currently requiring IPC from linux-devkit because that package is compiled with Linaro tools
 
 ARMV7OBJDIR ?= ./obj/$(DEVICE)
 ARMV7BINDIR ?= ./bin/$(DEVICE)
@@ -23,6 +26,12 @@ ifdef CROSS_TOOL_INSTALL_PATH
  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
 endif
 
+ifdef IPC_DEVKIT_INSTALL_PATH
+  IPCLIBDIRS := -L$(IPC_DEVKIT_INSTALL_PATH)/lib/
+else
+  IPCLIBDIRS :=
+endif
+
 # INCLUDE Directories
 RM_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/rm
 
@@ -30,19 +39,22 @@ RM_SRC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/rm
 RM_TEST_DIR = $(RM_SRC_DIR)/test
 RM_ARM_LIN_TEST_DIR = $(RM_TEST_DIR)/$(DEVICE)/armv7/linux
 
-INCDIR := $(PDK_INSTALL_PATH);$(RM_INC_DIR);$(RM_ARM_LIN_TEST_DIR)
+INCDIR := $(PDK_INSTALL_PATH);$(RM_INC_DIR);$(RM_ARM_LIN_TEST_DIR);$(IPC_DEVKIT_INSTALL_PATH)/include
 
 # Libraries
 RM_LIB = -lrm
+IPC_LIBS = -ltiipc -ltiipcutils -ltiipccfg_tci6638
 
 # Compiler options
 INTERNALDEFS = $(DEBUG_FLAG) -D__ARMv7 -DDEVICE_K2H -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD
 
 # Linker options
 INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(RM_LIB) -lrt -Wl,--end-group -pthread $(LDFLAGS)
+IPC_INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(IPCLIBDIRS) $(RM_LIB) $(IPC_LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)
 
 RM_SERVER_EXE=rmServer.out
-RM_CLIENT_TEST_EXE=rmClientTest.out
+RM_LINUX_CLIENT_TEST_EXE=rmLinuxClientTest.out
+RM_DSP_CLIENT_TEST_EXE=rmDspClientTest.out
 
 OBJEXT = o 
 
@@ -58,26 +70,34 @@ RM_SERVER_SRC =     \
     rm_linux_osal.c \
     sockutils.c
     
-RM_CLIENT_TEST_SRC = \
-    rm_client_test.c \
-    rm_linux_osal.c  \
+RM_LINUX_CLIENT_TEST_SRC = \
+    rm_linux_client_test.c \
+    rm_linux_osal.c        \
     sockutils.c
 
+RM_DSP_CLIENT_TEST_SRC = \
+    rm_dsp_client_test.c \
+    sockutils.c    
+
 # FLAGS for the SourceFiles
 SRC_CFLAGS = -I. $(CFLAGS)
 
 # Make Rule for the SRC Files
 RM_SERVER_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_SERVER_SRC))
-RM_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_CLIENT_TEST_SRC))
+RM_LINUX_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_LINUX_CLIENT_TEST_SRC))
+RM_DSP_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_DSP_CLIENT_TEST_SRC))
 
-all:$(ARMV7BINDIR)/$(RM_SERVER_EXE) $(ARMV7BINDIR)/$(RM_CLIENT_TEST_EXE)
+all:$(ARMV7BINDIR)/$(RM_SERVER_EXE) $(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE) $(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE)
 
 $(ARMV7BINDIR)/$(RM_SERVER_EXE): $(RM_SERVER_SRC_OBJS) $(ARMV7BINDIR)/.created
        @echo linking $(RM_SERVER_SRC_OBJS) into $@ ...
        @$(CC) $(RM_SERVER_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
-$(ARMV7BINDIR)/$(RM_CLIENT_TEST_EXE): $(RM_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
-       @echo linking $(RM_CLIENT_TEST_SRC_OBJS) into $@ ...
-       @$(CC) $(RM_CLIENT_TEST_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
+$(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE): $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
+       @echo linking $(RM_LINUX_CLIENT_TEST_SRC_OBJS) into $@ ...
+       @$(CC) $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
+$(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE): $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
+       @echo linking $(RM_DSP_CLIENT_TEST_SRC_OBJS) into $@ ...
+       @$(CC) $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(IPC_INTERNALLINKDEFS) -o $@     
 
 $(ARMV7OBJDIR)/%.$(OBJEXT): %.c $(ARMV7OBJDIR)/.created
        @echo compiling $< ...
diff --git a/test/k2h/armv7/linux/dspClientTest/dsp_client.c b/test/k2h/armv7/linux/dspClientTest/dsp_client.c
new file mode 100644 (file)
index 0000000..b157830
--- /dev/null
@@ -0,0 +1,1011 @@
+/*
+ *   dsp_client.c
+ *
+ *   DSP portion of Resource Manager ARM+DSP test that uses RPMSG and sockets to 
+ *   allow a DSP application to to request RM services from a RM Server running
+ *   from Linux User-space.
+ *
+ *  ============================================================================
+ *
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/* Standard includes */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+/* XDC includes */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/System.h>
+
+/* BIOS includes */
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* IPC includes */
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/HeapBufMP.h>
+#include <ti/ipc/MessageQ.h>
+
+/* CSL includes */
+#include <ti/csl/csl_chip.h>
+
+/* RM Includes */
+#include <ti/drv/rm/rm.h>
+#include <ti/drv/rm/rm_transport.h>
+#include <ti/drv/rm/rm_services.h>
+
+/**********************************************************************
+ ************************** RM Test Symbols ***************************
+ **********************************************************************/
+
+/* Test will run on this core */
+#define TEST_CORE                    0
+
+/* Test FALSE */
+#define RM_TEST_FALSE                0
+/* Test TRUE */
+#define RM_TEST_TRUE                 1
+
+/* RM packet heap name */
+#define MSGQ_HEAP_ID                 0
+
+/* MessageQ Name for DSP RM Client */
+#define CLIENT_MESSAGEQ_NAME         "RM_CLIENT"
+
+/* Size of RM static allocation response queue.  Must be greater than number of APPROVED
+ * static allocations */
+#define MAX_STATIC_ALLOCATION_RESPS  5 
+
+/* Size of RM service response queue */
+#define MAX_QUEUED_SERVICE_RESPONSES 10
+
+/* Error checking macro */
+#define ERROR_CHECK(checkVal, resultVal, rmInstName, printMsg)                   \
+    if (resultVal != checkVal) {                                                 \
+        char errorMsgToPrint[] = printMsg;                                       \
+        System_printf("Error Core %d : %s : ", coreNum, rmInstName);             \
+        System_printf("%s with error code : %d\n", errorMsgToPrint, resultVal);  \
+        testErrors++;                                                            \
+        System_abort("Test Failure\n");                                          \
+    }
+
+#define POSITIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check)  \
+    do {                                                                                            \
+        int32_t start = resStart;                                                                   \
+        int32_t alignment = align;                                                                  \
+        char    titleMsg[] = title;                                                                 \
+        System_printf ("Core %d : ---------------------------------------------------------\n",     \
+                       core);                                                                       \
+        System_printf ("Core %d : %s\n", core, titleMsg);                                           \
+        System_printf ("Core %d : - Instance Name: %-32s       -\n", core, instName);               \
+        System_printf ("Core %d : - Resource Name: %-32s       -\n", core, resName);                \
+        if (start == RM_RESOURCE_BASE_UNSPECIFIED) {                                                \
+            System_printf ("Core %d : - Start:         UNSPECIFIED                            -\n", \
+                           core);                                                                   \
+            System_printf ("Core %d : - Length:        %-16d                       -\n",            \
+                           core, resLen);                                                           \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - Start:         %-16d                       -\n",            \
+                           core, resStart);                                                         \
+            System_printf ("Core %d : - End:           %-16d                       -\n", core,      \
+                           (start + resLen - 1));                                                   \
+        }                                                                                           \
+        if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) {                                       \
+            System_printf ("Core %d : - Alignment:     UNSPECIFIED                            -\n", \
+                           core);                                                                   \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - Alignment:     %-16d                       -\n",            \
+                           core, alignment);                                                        \
+        }                                                                                           \
+        System_printf ("Core %d : -                                                       -\n",     \
+                       core);                                                                       \
+        if (state == check) {                                                                       \
+            System_printf ("Core %d : - PASSED                                                -\n", \
+                           core);                                                                   \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - FAILED - Denial: %-6d                               -\n",   \
+                           core, state);                                                            \
+            testErrors++;                                                                           \
+        }                                                                                           \
+        System_printf ("Core %d : ---------------------------------------------------------\n",     \
+                       core);                                                                       \
+        System_printf ("\n");                                                                       \
+    } while(0);
+
+#define NEGATIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check)  \
+    do {                                                                                            \
+        int32_t start = resStart;                                                                   \
+        int32_t alignment = align;                                                                  \
+        char    titleMsg[] = title;                                                                 \
+        System_printf ("Core %d : ---------------------------------------------------------\n",     \
+                       core);                                                                       \
+        System_printf ("Core %d : %s\n", core, titleMsg);                                           \
+        System_printf ("Core %d : - Instance Name: %-32s       -\n", core, instName);               \
+        System_printf ("Core %d : - Resource Name: %-32s       -\n", core, resName);                \
+        if (start == RM_RESOURCE_BASE_UNSPECIFIED) {                                                \
+            System_printf ("Core %d : - Start:         UNSPECIFIED                            -\n", \
+                           core);                                                                   \
+            System_printf ("Core %d : - Length:        %-16d                       -\n",            \
+                           core, resLen);                                                           \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - Start:         %-16d                       -\n",            \
+                           core, resStart);                                                         \
+            System_printf ("Core %d : - End:           %-16d                       -\n", core,      \
+                           (start + resLen - 1));                                                   \
+        }                                                                                           \
+        if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) {                                       \
+            System_printf ("Core %d : - Alignment:     UNSPECIFIED                            -\n", \
+                           core);                                                                   \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - Alignment:     %-16d                       -\n",            \
+                           core, alignment);                                                        \
+        }                                                                                           \
+        System_printf ("Core %d : -                                                       -\n",     \
+                       core);                                                                       \
+        if (state != check) {                                                                       \
+            System_printf ("Core %d : - PASSED - Denial: %-6d                               -\n",   \
+                           core, state);                                                            \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - FAILED - Expected Denial                              -\n", \
+                           core);                                                                   \
+            testErrors++;                                                                           \
+        }                                                                                           \
+        System_printf ("Core %d : ---------------------------------------------------------\n",     \
+                       core);                                                                       \
+        System_printf ("\n");                                                                       \
+    } while(0);    
+
+#define STATUS_PASS_CHECK(title, core, instName, resName, resStart, resLen, refCnt, state, check, expectRefCnt) \
+    do {                                                                                                        \
+        int32_t start = resStart;                                                                               \
+        char    titleMsg[] = title;                                                                             \
+        System_printf ("Core %d : ---------------------------------------------------------\n",                 \
+                       core);                                                                                   \
+        System_printf ("Core %d : %s\n", core, titleMsg);                                                       \
+        System_printf ("Core %d : - Instance Name: %-32s       -\n", core, instName);                           \
+        System_printf ("Core %d : - Resource Name: %-32s       -\n", core, resName);                            \
+        System_printf ("Core %d : - Start:         %-16d                       -\n",                            \
+                           core, resStart);                                                                     \
+        System_printf ("Core %d : - End:           %-16d                       -\n", core,                      \
+                           (start + resLen - 1));                                                               \
+        System_printf ("Core %d : - Expected Owner Count: %-16d                -\n",                            \
+                       core, expectRefCnt);                                                                     \
+        System_printf ("Core %d : - Returned Owner Count: %-16d                -\n",                            \
+                       core, refCnt);                                                                           \
+        System_printf ("Core %d : -                                                       -\n", core);          \
+        if ((state == check) && (refCnt == expectRefCnt)) {                                                     \
+            System_printf ("Core %d : - PASSED                                                -\n", core);      \
+        }                                                                                                       \
+        else {                                                                                                  \
+            if (refCnt != expectRefCnt) {                                                                       \
+                System_printf ("Core %d : - FAILED - Owner Count Mismatch                         -\n",         \
+                               core);                                                                           \
+            }                                                                                                   \
+            else {                                                                                              \
+                System_printf ("Core %d : - FAILED - Denial: %-6d                               -\n",           \
+                               core, state);                                                                    \
+            }                                                                                                   \
+            testErrors++;                                                                                       \
+        }                                                                                                       \
+        System_printf ("Core %d : ---------------------------------------------------------\n",                 \
+                       core);                                                                                   \
+        System_printf ("\n");                                                                                   \
+    } while(0);
+
+/**********************************************************************
+ ********************** RM Test Data Structures ***********************
+ **********************************************************************/
+
+/* IPC MessageQ RM packet encapsulation structure */
+typedef struct {
+    /* IPC MessageQ header (must be first element in structure) */
+    MessageQ_MsgHeader msgQHeader;
+    /* Pointer to RM packet */
+    Rm_Packet          rmPkt;
+} MsgQ_RmPacket;
+
+/**********************************************************************
+ ********************** Extern Variables ******************************
+ **********************************************************************/
+
+/* Alloc and free OSAL variables */
+extern uint32_t rmMallocCounter;
+extern uint32_t rmFreeCounter;
+
+/* RM test Static Policy provided to RM Client */
+extern const char rmStaticPolicy[];
+
+/**********************************************************************
+ ********************** Global Variables ******************************
+ **********************************************************************/
+
+/* Core number */
+uint16_t            coreNum;
+/* Number of errors that occurred during the test */
+uint16_t            testErrors;
+
+/* Task to configure application transport code for RM */
+Task_Handle         rmStartupTskHandle;
+/* High priority task for receiving RM packets */
+Task_Handle         rmReceiveTskHandle;
+/* RM client delegate and client test task */
+Task_Handle         rmClientTskHandle;
+
+/* Handle for heap that RM packets will be allocated from */
+HeapBufMP_Handle    rmPktHeapHandle = NULL;
+
+/* Client instance name (must match with RM Global Resource List (GRL) and policies */
+char                rmClientName[RM_NAME_MAX_CHARS] = "RM_Client";
+
+/* Client MessageQ */
+MessageQ_Handle     rmClientQ = NULL;
+
+/* Linux MessageQ ID */
+MessageQ_QueueId    linuxQueueId;
+
+/* Client instance handles */
+Rm_Handle           rmClientHandle = NULL;
+
+/* Client instance service handles */
+Rm_ServiceHandle   *rmClientServiceHandle = NULL;
+
+/* Client from Server transport handle */
+Rm_TransportHandle  clientFromServerTransportHandle;
+
+/* Static allocation response queue */
+Rm_ServiceRespInfo  staticResponseQueue[MAX_STATIC_ALLOCATION_RESPS];
+/* Static allocation response queue index */
+uint32_t            numStaticResponses;
+
+/* RM response info queue used to store service responses received via the callback function */
+Rm_ServiceRespInfo  responseInfoQueue[MAX_QUEUED_SERVICE_RESPONSES];
+
+/* RM resource names (must match resource node names in GRL and policies */
+char                resourceNameMemRegion[RM_NAME_MAX_CHARS]  = "memory-regions";
+char                resourceNameAccumCh[RM_NAME_MAX_CHARS]    = "accumulator-ch";
+char                resourceNameGpQ[RM_NAME_MAX_CHARS]        = "gp-queue";
+char                resourceNameAifQ[RM_NAME_MAX_CHARS]       = "aif-queue";
+char                resourceNameQosCluster[RM_NAME_MAX_CHARS] = "qos-cluster";
+char                resourceNameAifRxCh[RM_NAME_MAX_CHARS]    = "aif-rx-ch";
+char                resourceNameInfraQ[RM_NAME_MAX_CHARS]     = "infra-queue";
+
+/* Test RM NameServer name */
+char                nameServerNameFavQ[RM_NAME_MAX_CHARS]     = "My_Favorite_Queue";
+
+/**********************************************************************
+ *************************** Test Functions ***************************
+ **********************************************************************/
+
+Rm_Packet *transportAlloc(Rm_AppTransportHandle appTransport, uint32_t pktSize, Rm_PacketHandle *pktHandle)
+{
+    Rm_Packet     *rmPkt = NULL;
+    MsgQ_RmPacket *rmMsg = NULL;
+
+    /* Allocate a messageQ message for containing the RM packet */
+    rmMsg = (MsgQ_RmPacket *)MessageQ_alloc(MSGQ_HEAP_ID, sizeof(MsgQ_RmPacket));
+    if (rmMsg == NULL) {
+        System_printf("Error Core %d : MessageQ_alloc failed to allocate message: %d\n", coreNum);
+        testErrors++;
+        *pktHandle = NULL;
+        return(NULL);
+    }
+    else {
+        rmPkt = &(rmMsg->rmPkt);
+        rmPkt->pktLenBytes = pktSize;
+        *pktHandle = (Rm_PacketHandle)rmMsg;
+    }
+    return (rmPkt);    
+}
+
+void transportFree (MessageQ_Msg rmMsgQMsg)
+{
+    int32_t  status;
+
+    status = MessageQ_free(rmMsgQMsg);
+    if (status < 0) { 
+        System_printf("Error Core %d : MessageQ_free failed to free message: %d\n", coreNum, status);
+        testErrors++;
+    }        
+}
+
+int32_t transportSend (Rm_AppTransportHandle appTransport, Rm_PacketHandle pktHandle)
+{
+    MessageQ_QueueId *remoteQueueId = (MessageQ_QueueId *)appTransport;
+    MsgQ_RmPacket    *rmMsg = pktHandle;
+    int32_t           status;    
+    
+    /* Send the message to Linux */
+    status = MessageQ_put(*remoteQueueId, (MessageQ_Msg)rmMsg);
+    if (status < 0) {
+        System_printf("Error Core %d : MessageQ_put failed to send message: %d\n", coreNum, status);
+        testErrors++;
+    }
+    
+    return (0);
+}
+
+void transportReceive (void)
+{
+    int32_t          numPkts;
+    MessageQ_Msg     rmMsg = NULL;
+    Rm_Packet       *rmPkt = NULL;
+    int32_t          status;
+    uint32_t         i;  
+
+    /* Check if any packets available */
+    numPkts = (int32_t) MessageQ_count(rmClientQ);
+
+    /* Process all available packets */
+    for (i = 0; i < numPkts; i++) {
+        status = (int32_t) MessageQ_get(rmClientQ, &rmMsg, MessageQ_FOREVER);
+        if (rmMsg == NULL) {
+            System_printf("Error Core %d : MessageQ_get failed, returning a NULL packet\n", coreNum);
+            testErrors++;
+        }
+
+        /* Extract the Rm_Packet from the RM msg */
+        rmPkt = &(((MsgQ_RmPacket *)rmMsg)->rmPkt);
+
+        /* Provide packet to RM for processing */
+        if (status = Rm_receivePacket(clientFromServerTransportHandle, rmPkt)) {
+            System_printf("Error Core %d : RM failed to process received packet: %d\n", coreNum, status);
+            testErrors++;
+        }
+
+        /* Free RM packet buffer and messageQ message */
+        transportFree(rmMsg);
+    }
+}
+
+void serviceCallback(Rm_ServiceRespInfo *serviceResponse)
+{
+    uint32_t qIndex = 0;
+    
+    /* Populate next free entry in the responseInfoQueue */
+    while (responseInfoQueue[qIndex].serviceId != 0) {
+        qIndex++;
+        if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
+            qIndex = 0;
+        }
+    }
+
+    /* Save the response in the response queue for the test task to pick up */
+    memcpy((void *)&responseInfoQueue[qIndex], (void *)serviceResponse, sizeof(Rm_ServiceRespInfo));
+}
+
+/* Packets received via rpmsg port will issue callback vai transportReceive function */
+void waitForResponse(Rm_ServiceRespInfo *respInfo)
+{
+    uint32_t qIndex = 0;
+
+    if ((respInfo->serviceState == RM_SERVICE_PROCESSING) ||
+        (respInfo->serviceState == RM_SERVICE_PENDING_SERVER_RESPONSE)) {
+        /* Scan responseInfoQueue for the response received via the callback function */
+        while((responseInfoQueue[qIndex].serviceId != respInfo->serviceId) ||
+              (responseInfoQueue[qIndex].rmHandle != respInfo->rmHandle)) {            
+            qIndex++;
+            if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
+                qIndex = 0;
+            }
+
+            /* Higher priority receive task will retrieve response */
+        }  
+
+        memcpy((void *)respInfo, (void *)&responseInfoQueue[qIndex], sizeof(Rm_ServiceRespInfo));
+        memset((void *)&responseInfoQueue[qIndex], 0, sizeof(Rm_ServiceRespInfo));
+    }
+}
+
+void setRmRequest(Rm_ServiceReqInfo *reqInfo, Rm_ServiceType type, const char *resName, int32_t resBase,
+                  uint32_t resLen, int32_t resAlign, const char *nsName, int setCallback, Rm_ServiceRespInfo *respInfo)
+{                                                                                
+    memset((void *)reqInfo, 0, sizeof(Rm_ServiceReqInfo));                                        
+    reqInfo->type = type;                                                                           
+    reqInfo->resourceName = resName;                                                                
+    reqInfo->resourceBase = resBase;                                                                
+    reqInfo->resourceLength = resLen;                                                               
+    reqInfo->resourceAlignment = resAlign;                                                          
+    reqInfo->resourceNsName = nsName;
+    if (setCallback) {
+        reqInfo->callback.serviceCallback = serviceCallback;  
+    }
+    memset((void *)respInfo, 0, sizeof(Rm_ServiceRespInfo));                                     
+}
+
+void rmCleanupTsk(UArg arg0, UArg arg1)
+{
+    Rm_ServiceReqInfo  requestInfo;
+    Rm_ServiceRespInfo responseInfo;     
+    int32_t            result;
+    int32_t            finalMallocFree; 
+
+    /* Free all allocated resources */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAccumCh, 
+                 0, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAccumCh, 
+                 40, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameQosCluster, 
+                 0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);   
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameQosCluster, 
+                 2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifQ, 
+                 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);  
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifQ, 
+                 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameInfraQ, 
+                 800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
+                 7000, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); 
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
+                 7011, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
+                 7010, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);   
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
+                 7005, 25, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
+                 0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); 
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
+                 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+
+    /* Cleanup all service ports, transport handles, RM instances, and IPC constructs */
+    result = Rm_serviceCloseHandle(rmClientServiceHandle);
+    ERROR_CHECK(RM_OK, result, rmClientName, "Service handle close failed");
+
+    result = Rm_transportUnregister(clientFromServerTransportHandle);
+    ERROR_CHECK(RM_OK, result, rmClientName, "Unregister of Server transport failed");
+
+       result = MessageQ_delete(&rmClientQ);
+    if (result < 0) {
+        System_printf("Core %d : Error in MessageQ_delete [%d]\n", coreNum, result);
+        testErrors++;
+    }
+    result = Rm_delete(rmClientHandle, RM_TEST_TRUE);
+    ERROR_CHECK(RM_OK, result, rmClientName, "Instance delete failed");
+
+    System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
+    System_printf ("Core %d : ------------------ Memory Leak Check --------------------\n", coreNum);
+    System_printf ("Core %d : -                       : malloc count   |   free count -\n", coreNum);
+    System_printf ("Core %d : - Example Completion    :  %6d        |  %6d      -\n", coreNum,
+                   rmMallocCounter, rmFreeCounter);
+    finalMallocFree = rmMallocCounter - rmFreeCounter; 
+    if (finalMallocFree > 0) {
+        System_printf ("Core %d : - FAILED - %6d unfreed mallocs                       -\n",
+                       coreNum, finalMallocFree);
+        testErrors++;
+    }
+    else if (finalMallocFree < 0) {
+        System_printf ("Core %d : - FAILED - %6d more frees than mallocs               -\n",
+                       coreNum, -finalMallocFree);
+        testErrors++;
+    }
+    else {
+        System_printf ("Core %d : - PASSED                                                -\n",
+                       coreNum);
+    }
+    System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
+    System_printf ("\n");  
+
+    System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
+    System_printf ("Core %d : ------------------ Example Completion -------------------\n", coreNum);
+    if (testErrors) {
+        System_printf ("Core %d : - Test Errors: %-32d         -\n", coreNum, testErrors);
+    }
+    System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
+    System_printf ("\n"); 
+}
+
+/* Receive task has priority of 2 so that it pre-empts the RM instance test tasks */
+void rmReceiveTsk(UArg arg0, UArg arg1)
+{
+    while(1) {
+        transportReceive();
+        /* Sleep for 1ms so that the main test tasks can run */
+        Task_sleep(1);
+    }
+}
+
+void rmClientTsk(UArg arg0, UArg arg1)
+{
+    Rm_ServiceReqInfo  requestInfo;
+    Rm_ServiceRespInfo responseInfo;  
+    Task_Params        taskParams;
+    uint32_t           i, j;
+
+    /* Create new NameServer object */                
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_MAP_TO_NAME, resourceNameGpQ, 
+                 1002, 1, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("--------------- Create NameServer Object ----------------", 
+                        coreNum, rmClientName, resourceNameGpQ,
+                        requestInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); 
+
+    /* Retrieve a resource via a NameServer name */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_GET_BY_NAME, NULL, 
+                 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("------- Retrieve Resource Via NameServer Object ---------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        0, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+
+    /* Allocate the resource returned from the NameServer request */
+    memset((void *)&requestInfo, 0, sizeof(Rm_ServiceReqInfo)); 
+    requestInfo.type = Rm_service_RESOURCE_ALLOCATE_INIT;
+    requestInfo.resourceName = responseInfo.resourceName;
+    requestInfo.resourceBase = responseInfo.resourceBase;
+    requestInfo.resourceLength = responseInfo.resourceLength;
+    requestInfo.resourceNsName = NULL;
+    requestInfo.callback.serviceCallback = serviceCallback;     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------- Init Allocate Using Retrieved Resource ---------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+
+    /* Retrieve the resource status via the NameServer name */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, NULL, 
+                 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    STATUS_PASS_CHECK("---- Retrieve Resource Status Via NameServer Object -----", 
+                      coreNum, rmClientName, responseInfo.resourceName,
+                      responseInfo.resourceBase, responseInfo.resourceLength, 
+                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);  
+
+    /* Free resource via a NameServer name */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, NULL, 
+                 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("--- Free of Retrieved Resource Using NameServer Name ----", 
+                        coreNum, rmClientName, nameServerNameFavQ,
+                        0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    /* Delete the NameServer name */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_UNMAP_NAME, NULL, 
+                 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("--------------- Delete NameServer Object ----------------", 
+                        coreNum, rmClientName, nameServerNameFavQ,
+                        0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
+                 0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo);    
+    POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Use Allocate) --", 
+                        coreNum, rmClientName, resourceNameAifRxCh,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifRxCh, 
+                 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);        
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo);    
+    POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Init Allocate) -", 
+                        coreNum, rmClientName, resourceNameAifRxCh,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+    /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */
+
+    /* BEGIN testing allocations with UNSPECIFIED base and alignment values */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 5, 4, NULL, RM_TEST_TRUE, &responseInfo);        
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------", 
+                        coreNum, rmClientName, resourceNameAccumCh,
+                        RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 2, 1, NULL, RM_TEST_TRUE, &responseInfo);      
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo); 
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------", 
+                        coreNum, rmClientName, resourceNameAccumCh,
+                        RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 2, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("---- Use Allocation w/ UNSPECIFIED Base & Alignment -----", 
+                        coreNum, rmClientName, resourceNameAccumCh,
+                        RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
+                        RM_RESOURCE_ALIGNMENT_UNSPECIFIED, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+    /* END testing allocations with UNSPECIFIED base and alignment values */    
+
+    /* Allocate infrastructure queue shared between Linux kernel and Client */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ, 
+                 800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-- Init Allocation of Shared Linux and Client Resource --", 
+                        coreNum, rmClientName, resourceNameInfraQ,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    /* BEGIN Allocating some resources without providing a callback function.  RM should block and not return until the result
+     * is returned by the server. */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
+                 7000, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("- Init Allocation (RM Blocked Until Resource Returned) --", 
+                        coreNum, rmClientName, resourceNameGpQ,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
+                 7005, 25, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);  
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --", 
+                        coreNum, rmClientName, resourceNameGpQ,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
+                 7010, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo); 
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --", 
+                        coreNum, rmClientName, resourceNameGpQ,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+
+    /* Init allocation of resource already owned by Client should return approved and there should only
+     * be one instance of Client in resource's owner list. */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
+                 7011, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);  
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("----- Use Allocation of Owned Resource (RM Blocked) -----", 
+                        coreNum, rmClientName, resourceNameGpQ,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+    /* END Allocating some resources without providing a callback function.  RM should block and not return
+     * until the result is returned by the Server. */   
+
+    /* BEGIN Getting the status of resources from Client and CD */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ, 
+                 7012, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo);  
+    STATUS_PASS_CHECK("-- Status Check of Resources from Client (Non-Blocking) -", 
+                      coreNum, rmClientName, responseInfo.resourceName,
+                      responseInfo.resourceBase, responseInfo.resourceLength, 
+                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);   
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ, 
+                 4025, 20, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo);   
+    STATUS_PASS_CHECK("---- Status Check of Resources from Client (Blocking) ---", 
+                      coreNum, rmClientName, responseInfo.resourceName,
+                      responseInfo.resourceBase, responseInfo.resourceLength, 
+                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);  
+    /* END Getting the status of resources from Client and CD */    
+
+    /* Verify static allocations were validated.  Validation responses should have been received after the
+     * first service requests were made on the Client and CD post transport path registration. */
+    while (numStaticResponses > 0) {
+        /* Loop until all static request validations have been received */
+        for (i = 0; i < MAX_STATIC_ALLOCATION_RESPS; i++) {
+            if (staticResponseQueue[i].serviceId != 0) {            
+                for (j = 0; j < MAX_QUEUED_SERVICE_RESPONSES; j++) {
+                    if ((staticResponseQueue[i].serviceId == responseInfoQueue[j].serviceId) &&
+                        (staticResponseQueue[i].rmHandle == responseInfoQueue[j].rmHandle)) {                   
+                        POSITIVE_PASS_CHECK("------------- Static Allocation Validation --------------", 
+                                            coreNum, rmClientName, responseInfoQueue[j].resourceName,
+                                            responseInfoQueue[j].resourceBase, responseInfoQueue[j].resourceLength, 
+                                            0, responseInfoQueue[j].serviceState, 
+                                            RM_SERVICE_APPROVED); 
+                        memset((void *)&staticResponseQueue[i], 0, sizeof(Rm_ServiceRespInfo));
+                        memset((void *)&responseInfoQueue[j], 0, sizeof(Rm_ServiceRespInfo));
+                        numStaticResponses--;                        
+                        break;
+                    }
+                }
+            }
+        }    
+    }  
+
+    /* Create the RM cleanup task. */
+    System_printf("Core %d : Creating RM cleanup task...\n", coreNum);
+    Task_Params_init (&taskParams);
+    Task_create (rmCleanupTsk, &taskParams, NULL);
+}
+
+void rmStartupTsk(UArg arg0, UArg arg1)
+{
+    Task_Params      taskParams;  
+    Char             localQueueName[64];    
+    MessageQ_Msg     msg;
+    Rm_TransportCfg  rmTransCfg;
+    int32_t          rm_result;
+
+    /* Construct a MessageQ name adorned with core name: */
+    System_sprintf(localQueueName, "%s_%s", CLIENT_MESSAGEQ_NAME,
+                   MultiProc_getName(MultiProc_self()));
+
+    rmClientQ = MessageQ_create(localQueueName, NULL);
+    if (rmClientQ == NULL) {
+        System_abort("MessageQ_create failed\n");
+    }
+
+    if (coreNum == TEST_CORE) {
+        System_printf("Awaiting sync message from host...\n");
+        MessageQ_get(rmClientQ, &msg, MessageQ_FOREVER);
+        
+        linuxQueueId = MessageQ_getReplyQueue(msg);
+        MessageQ_put(linuxQueueId, msg);
+
+        /* Register the Server with the Client instance */
+        rmTransCfg.rmHandle = rmClientHandle;
+        rmTransCfg.appTransportHandle = (Rm_AppTransportHandle) &linuxQueueId;
+        rmTransCfg.remoteInstType = Rm_instType_SERVER;
+        rmTransCfg.transportCallouts.rmAllocPkt = transportAlloc;
+        rmTransCfg.transportCallouts.rmSendPkt = transportSend;
+        clientFromServerTransportHandle = Rm_transportRegister(&rmTransCfg, &rm_result);  
+
+        /* Create the RM receive task.  Assign higher priority than the test tasks so that
+         * when they spin waiting for messages from other RM instances the receive task is
+         * executed. */
+        System_printf("Core %d : Creating RM receive task...\n", coreNum);
+        Task_Params_init (&taskParams);
+        taskParams.priority = 2;
+        rmReceiveTskHandle = Task_create (rmReceiveTsk, &taskParams, NULL);
+
+        System_printf("Core %d : Creating RM client task...\n", coreNum);
+        Task_Params_init (&taskParams);
+        taskParams.priority = 1;
+        rmClientTskHandle = Task_create (rmClientTsk, &taskParams, NULL);
+    }
+}
+
+int main(int argc, char *argv[])
+{ 
+    Task_Params        taskParams;     
+    Rm_InitCfg         rmInitCfg;
+    Rm_ServiceReqInfo  requestInfo;
+    Rm_ServiceRespInfo responseInfo;
+    int32_t            result;
+
+
+    System_printf ("*********************************************************\n");
+    System_printf ("************ RM DSP+ARM DSP Client Testing **************\n");
+    System_printf ("*********************************************************\n");
+
+    System_printf ("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr());
+
+    coreNum = CSL_chipReadReg(CSL_CHIP_DNUM);
+
+    if (coreNum == TEST_CORE) {
+        testErrors = 0;  
+
+        /* Initialize the RM Client - RM must be initialized before anything else in the system */
+        memset(&rmInitCfg, 0, sizeof(rmInitCfg));
+        rmInitCfg.instName = rmClientName;
+        rmInitCfg.instType = Rm_instType_CLIENT;
+        rmInitCfg.instCfg.clientCfg.staticPolicy = (void *)rmStaticPolicy;
+        rmClientHandle = Rm_init(&rmInitCfg, &result);
+        ERROR_CHECK(RM_OK, result, rmClientName, "Initialization failed");
+
+        System_printf("\n\nInitialized %s\n\n", rmClientName);
+
+        /* Open Client service handle */
+        rmClientServiceHandle = Rm_serviceOpenHandle(rmClientHandle, &result);
+        ERROR_CHECK(RM_OK, result, rmClientName, "Service handle open failed");
+
+        /* Initialize the static allocation response queue */
+        for (numStaticResponses = 0; numStaticResponses < MAX_STATIC_ALLOCATION_RESPS; numStaticResponses++) {
+            memset((void *)&staticResponseQueue[numStaticResponses], 0, sizeof(Rm_ServiceRespInfo));
+        }
+        numStaticResponses = 0;
+
+        /* Static allocation tests */
+        setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
+                     0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);               
+        POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
+                            coreNum, rmClientName, resourceNameQosCluster,
+                            requestInfo.resourceBase, requestInfo.resourceLength, 
+                            requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
+        if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
+            memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
+        }        
+        
+        setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
+                     2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+        POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
+                            coreNum, rmClientName, resourceNameQosCluster,
+                            requestInfo.resourceBase, requestInfo.resourceLength, 
+                            requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
+        if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
+            memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
+        }           
+
+        /* Request resource from Client that can only be allocated to CD according to static policy */
+        setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
+                     1, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+        NEGATIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
+                            coreNum, rmClientName, resourceNameQosCluster,
+                            requestInfo.resourceBase, requestInfo.resourceLength, 
+                            requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);          
+
+        /* Request resource from both Client and CD that is shared according to static policy */
+        setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ, 
+                     525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+        POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
+                            coreNum, rmClientName, resourceNameAifQ,
+                            requestInfo.resourceBase, requestInfo.resourceLength, 
+                            requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
+        if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
+            memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
+        }           
+
+        setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ, 
+                     525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo); 
+        POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
+                            coreNum, rmClientName, resourceNameAifQ,
+                            requestInfo.resourceBase, requestInfo.resourceLength, 
+                            requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
+        if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
+            memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
+        }   
+
+    }
+    else {
+        System_printf("Core %d : RM DSP+ARM Linux test not executing on this core\n", coreNum);
+    }
+
+    /* Create the RM startup task */
+    System_printf("Core %d : Creating RM startup task...\n", coreNum);
+    Task_Params_init (&taskParams);
+    rmStartupTskHandle = Task_create (rmStartupTsk, &taskParams, NULL);
+
+    System_printf("Core %d : Starting BIOS...\n", coreNum);
+    BIOS_start();
+
+    return (0);    
+}
+
diff --git a/test/k2h/armv7/linux/dspClientTest/dsp_client.cfg b/test/k2h/armv7/linux/dspClientTest/dsp_client.cfg
new file mode 100644 (file)
index 0000000..e680265
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+xdc.loadCapsule("dsp_client.cfg.xs");
+
+var MessageQ  = xdc.useModule('ti.sdo.ipc.MessageQ');
+
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+MessageQ.SetupTransportProxy = VirtioSetup;
+
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+var TransportRpmsg = xdc.useModule('ti.ipc.transports.TransportRpmsg');
+
diff --git a/test/k2h/armv7/linux/dspClientTest/dsp_client.cfg.xs b/test/k2h/armv7/linux/dspClientTest/dsp_client.cfg.xs
new file mode 100644 (file)
index 0000000..0966d18
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * 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 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);
+
+if (Program.platformName.match(/6614/)) {
+    var VirtQueue = xdc.useModule('ti.ipc.family.tci6614.VirtQueue');
+    var Interrupt = xdc.useModule('ti.ipc.family.tci6614.Interrupt');
+
+    /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3"]);
+
+    Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+    Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+    Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+    var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+    Hwi.enableException = true;
+
+    /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
+       We assume the rest is to be left cacheable.
+       Per sprugw0b.pdf
+        0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
+        0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
+    */
+    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+    /*  This doesn't work:
+         Cache.MAR160_191 = 0xFFFFFFFC;
+         So, need to do this:
+    */
+    Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
+
+    Program.global.sysMinBufSize = 0x8000;
+    SysMin.bufSize  =  Program.global.sysMinBufSize;
+
+    /* Enable Memory Translation module that operates on the Resource Table */
+    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+    Resource.loadSegment = Program.platform.dataMemory;
+
+    /*  COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
+    /*
+    Diags.setMaskMeta("ti.ipc.family.tci6614.Interrupt", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.family.tci6614.VirtQueue", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
+        Diags.INFO|Diags.USER1|Diags.STATUS,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
+        Diags.ALWAYS_ON);
+    */
+}
+else if (Program.platformName.match(/simKepler/) ||
+        Program.cpu.deviceName.match(/^TMS320TCI6638$/)) {
+    var VirtQueue = xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
+    var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+
+    /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3",
+                               "CORE4", "CORE5", "CORE6", "CORE7"]);
+    Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+    Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+    Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+    var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+    Hwi.enableException = true;
+
+    /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
+       We assume the rest is to be left cacheable.
+       Per sprugw0b.pdf
+        0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
+        0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
+    */
+    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+    /*  This doesn't work:
+         Cache.MAR160_191 = 0xFFFFFFFC;
+         So, need to do this:
+    */
+    /* TBD: Update for Kepler: */
+    Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
+
+    Program.global.sysMinBufSize = 0x8000;
+    SysMin.bufSize  =  Program.global.sysMinBufSize;
+
+    /* Enable Memory Translation module that operates on the Resource Table */
+    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+    Resource.loadSegment = Program.platform.dataMemory;
+
+    /*  COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
+    /*
+    Diags.setMaskMeta("ti.ipc.family.tci6638.Interrupt", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.family.tci6638.VirtQueue", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
+        Diags.INFO|Diags.USER1|Diags.STATUS,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
+        Diags.ALWAYS_ON);
+    */
+}
+else {
+    throw("messageq_common.cfg.xs: Did not match any platform!");
+}
+
+Hwi.enableException = true;
+
+xdc.loadPackage('ti.ipc.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 VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+VirtioSetup.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';
+
+/* PDK packages */
+var devType = "k2h"
+var Csl = xdc.useModule('ti.csl.Settings');
+Csl.deviceType = devType;
+var Rm = xdc.loadPackage('ti.drv.rm'); 
+
diff --git a/test/k2h/armv7/linux/rm_dsp_client_test.c b/test/k2h/armv7/linux/rm_dsp_client_test.c
new file mode 100644 (file)
index 0000000..d54fa50
--- /dev/null
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== rm_dsp_client_test.c ========
+ *
+ *  Works with the dspClientTest DSP application over the rpmsg-proto socket.
+ */
+
+/* Standard headers */
+#include <stdio.h>
+#include <stdlib.h>
+
+/* IPC Headers */
+#include <Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+
+/* Socket Includes */
+#include "sockutils.h"
+#include "sockrmmsg.h"
+
+/* RM includes */
+#include <ti/drv/rm/rm_transport.h>
+
+/* App defines:  Must match on remote proc side: */
+#define HEAPID               0u
+#define CLIENT_MESSAGEQ_NAME "RM_CLIENT"
+#define SERVER_MESSAGEQ_NAME "RM_SERVER"
+
+#define PROC_ID_DEFAULT      1     /* Host is zero, remote cores start at 1 */
+
+/* IPC MessageQ RM packet encapsulation structure */
+typedef struct {
+    /* IPC MessageQ header (must be first element in structure) */
+    MessageQ_MsgHeader msgQHeader;
+    /* Pointer to RM packet */
+    Rm_Packet          rmPkt;
+} MsgQ_RmPacket;
+
+Int rmServerExchange_execute(UInt16 procId)
+{
+    int32_t           status = 0;
+    int               err;
+    MessageQ_Msg      msg = NULL;
+    MessageQ_Params   msgParams;
+    MessageQ_QueueId  queueId = MessageQ_INVALIDMESSAGEQ;
+    MessageQ_Handle   msgqHandle;
+    char              remoteQueueName[64];
+    MessageQ_Msg      rmMsg;
+    Rm_Packet        *rmPkt;
+    int               rm_pkt_len;
+    sock_h            sock_to_server;
+    sock_name_t       local_sock_name;
+    sock_name_t       server_sock;
+    sock_name_t       server_sock_addr;
+    struct sockaddr_un  server_addr;
+    char              client_ex_sock_name[] = "/tmp/var/run/rm/rm_dsp_client_exchange";
+    char              server_sock_name[] = RM_SERVER_SOCKET_NAME;    
+
+    printf("Entered rmServerExchange_execute\n");
+    /* Create the local Message Queue for receiving from DSP Client. */
+    MessageQ_Params_init(&msgParams);
+    msgqHandle = MessageQ_create(SERVER_MESSAGEQ_NAME, &msgParams);
+    if (msgqHandle == NULL) {
+       printf("Error in MessageQ_create\n");
+       goto exit;
+    }
+    else {
+       printf("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
+    }
+
+    sprintf(remoteQueueName, "%s_%s", CLIENT_MESSAGEQ_NAME,
+            MultiProc_getName(procId));
+
+    /* Poll until remote side has it's messageQ created before we send: */
+    do {
+       status = MessageQ_open(remoteQueueName, &queueId);
+       sleep (1);
+    } while (status == MessageQ_E_NOTFOUND);
+
+    if (status < 0) {
+       printf("Error in MessageQ_open [%d]\n", status);
+       goto cleanup;
+    }
+    else {
+       printf("Remote queueId  [0x%x]\n", queueId);
+    }
+
+    msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader));
+    if (msg == NULL) {
+       printf("Error in MessageQ_alloc\n");
+       MessageQ_close(&queueId);
+       goto cleanup;
+    }
+
+    /* handshake with DSP client so that it knows Linux's receive Q */
+    MessageQ_setReplyQueue(msgqHandle, msg);
+    MessageQ_put(queueId, msg);
+    MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
+    MessageQ_free(msg);
+
+    printf("Setting up socket connection with RM Server\n");
+
+    /* open local sock for communication to RM Server */
+    local_sock_name.type = sock_name_e;
+       local_sock_name.s.name = client_ex_sock_name;
+    sock_to_server = sock_open(&local_sock_name);
+    if (!sock_to_server) {
+       printf("Local socket to RM Server open failed\n");
+       return -1;
+    }
+    /* RM Server sock */
+    server_sock.type = sock_name_e;
+    server_sock.s.name = server_sock_name;
+
+    printf("Waiting for RM messages from DSP Client\n");
+
+    while(1) {
+        status = MessageQ_get(msgqHandle, &rmMsg, MessageQ_FOREVER);
+        if (status < 0) {
+            printf("Error in MessageQ_get [%d]\n", status);
+            break;
+        }
+
+        rmPkt = &(((MsgQ_RmPacket *)rmMsg)->rmPkt);
+        printf("Received RM pkt of size %d from DSP client\n", rmPkt->pktLenBytes);
+
+        /* Send received data to RM Server */
+        if (sock_send(sock_to_server, (char *)rmPkt, sizeof(*rmPkt), &server_sock)) {
+           printf("Failed to send data to RM Server\n");
+        }
+
+        /* Wait for response from RM Server */
+        rm_pkt_len = 0;
+        err = sock_wait(sock_to_server, &rm_pkt_len, NULL, -1);
+        if (err == -2) {
+           /* Timeout */
+           printf("Error socket timeout\n");
+           return -1;
+        }
+        else if (err < 0) {
+           printf("Error in reading from socket, error %d\n", err);
+           return -1;
+        }        
+
+        server_sock_addr.type = sock_addr_e;
+        server_sock_addr.s.addr = &server_addr;
+        err = sock_recv(sock_to_server, (char *)rmPkt, rm_pkt_len, &server_sock_addr);
+        if (err != rm_pkt_len) {
+           printf("recv RM pkt failed from socket, received = %d, expected = %d\n",
+                  err, rm_pkt_len);
+           return;
+        }
+
+        /* send back to DSP */
+        status = MessageQ_put(queueId, rmMsg);
+        if (status < 0) {
+            printf("Error in MessageQ_put [%d]\n", status);
+            break;
+        }
+    }
+
+cleanup:
+    /* Clean-up */
+    status = MessageQ_delete(&msgqHandle);
+    if (status < 0) {
+        printf("Error in MessageQ_delete [%d]\n", status);
+    }
+
+exit:
+    printf("Leaving rmServerExchange_execute\n\n");
+
+    return 0;
+}
+
+int main (int argc, char ** argv)
+{
+    Int32 status = 0;
+    UInt16 procId = PROC_ID_DEFAULT;
+
+    /* Parse Args: */
+    switch (argc) {
+        case 1:
+           /* use defaults */
+           break;
+        case 2:
+           procId = atoi(argv[2]);
+           break;
+        default:
+           printf("Usage: %s [<ProcId>]\n", argv[0]);
+           printf("\tDefaults: ProcId: %d\n", PROC_ID_DEFAULT);
+           exit(0);
+    }
+    if (procId >= MultiProc_getNumProcessors()) {
+        printf("ProcId must be less than %d\n", MultiProc_getNumProcessors());
+        exit(0);
+    }
+    printf("Using procId : %d\n", procId);
+
+    status = Ipc_start();
+
+    if (status >= 0) {
+        rmServerExchange_execute(procId);
+        Ipc_stop();
+    }
+    else {
+        printf("Ipc_start failed: status = %d\n", status);
+    }
+
+    return(0);   
+}
index 691e60e43cd7ff4ccc801ed03c90e2ec98a4ebc5..0445f5aad55e1eb22821520f69f8c584337de12b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *   rm_arm_test.c
+ *   rm_linux_client_test.c
  *
  *   Multi-process Resource Manager test that uses sockets to allow a Linux
  *   User-space application to request RM services from a RM Server, 
@@ -817,10 +817,6 @@ void client_test(void)
             }
         }    
     }  
-
-#if PRINT_USED_RESOURCES
-    Rm_resourceStatus(rmCdHandle, RM_TEST_TRUE);
-#endif
 }
 
 void connection_setup(void)
diff --git a/test/k2h/c66/bios/rmK2HArmv7LinuxDspClientTestProject.txt b/test/k2h/c66/bios/rmK2HArmv7LinuxDspClientTestProject.txt
new file mode 100644 (file)
index 0000000..8a14f86
--- /dev/null
@@ -0,0 +1,8 @@
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/armv7/linux/dspClientTest/dsp_client.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/static-policy.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/c66/bios/rm_osal.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/armv7/linux/dspClientTest/dsp_client.cfg"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/armv7/linux/dspClientTest/dsp_client.cfg.xs"
+-ccs.setCompilerOptions "-mv6600 -g -DDEVICE_K2H --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm" 
+-rtsc.enableRtsc
+
index 8b513d2b8e9ff83a012498efaf53121cd033d2e0..3910b92ca2559d734c75629ac470f25016f88297 100755 (executable)
@@ -6,6 +6,9 @@ empty =
 space =$(empty) $(empty)
 
 PDK_INSTALL_PATH ?= ../../..
+# IPC_DEVKIT_INSTALL_PATH ?= need/to/set/path
+# export IPC_DEVKIT_INSTALL_PATH if IPC is not in /usr/lib
+# Currently requiring IPC from linux-devkit because that package is compiled with Linaro tools
 
 ARMV7OBJDIR ?= ./obj/$(DEVICE)
 ARMV7BINDIR ?= ./bin/$(DEVICE)
@@ -23,6 +26,12 @@ ifdef CROSS_TOOL_INSTALL_PATH
  LD = $(CROSS_TOOL_INSTALL_PATH)/$(CROSS_TOOL_PRFX)gcc
 endif
 
+ifdef IPC_DEVKIT_INSTALL_PATH
+  IPCLIBDIRS := -L$(IPC_DEVKIT_INSTALL_PATH)/lib/
+else
+  IPCLIBDIRS :=
+endif
+
 # INCLUDE Directories
 RM_INC_DIR = $(PDK_INSTALL_PATH)/ti/drv/rm
 
@@ -30,19 +39,22 @@ RM_SRC_DIR ?= $(PDK_INSTALL_PATH)/ti/drv/rm
 RM_TEST_DIR = $(RM_SRC_DIR)/test
 RM_ARM_LIN_TEST_DIR = $(RM_TEST_DIR)/$(DEVICE)/armv7/linux
 
-INCDIR := $(PDK_INSTALL_PATH);$(RM_INC_DIR);$(RM_ARM_LIN_TEST_DIR)
+INCDIR := $(PDK_INSTALL_PATH);$(RM_INC_DIR);$(RM_ARM_LIN_TEST_DIR);$(IPC_DEVKIT_INSTALL_PATH)/include
 
 # Libraries
 RM_LIB = -lrm
+IPC_LIBS = -ltiipc -ltiipcutils -ltiipccfg_tci6638
 
 # Compiler options
 INTERNALDEFS = $(DEBUG_FLAG) -D__ARMv7 -DDEVICE_K2K -D_VIRTUAL_ADDR_SUPPORT -D__LINUX_USER_SPACE -D_LITTLE_ENDIAN=1 -DMAKEFILE_BUILD
 
 # Linker options
 INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(RM_LIB) -lrt -Wl,--end-group -pthread $(LDFLAGS)
+IPC_INTERNALLINKDEFS = -Wl,--start-group -L $(ARMV7LIBDIR) $(IPCLIBDIRS) $(RM_LIB) $(IPC_LIBS) -lrt -Wl,--end-group -pthread $(LDFLAGS)
 
 RM_SERVER_EXE=rmServer.out
-RM_CLIENT_TEST_EXE=rmClientTest.out
+RM_LINUX_CLIENT_TEST_EXE=rmLinuxClientTest.out
+RM_DSP_CLIENT_TEST_EXE=rmDspClientTest.out
 
 OBJEXT = o 
 
@@ -58,26 +70,34 @@ RM_SERVER_SRC =     \
     rm_linux_osal.c \
     sockutils.c
     
-RM_CLIENT_TEST_SRC = \
-    rm_client_test.c \
-    rm_linux_osal.c  \
+RM_LINUX_CLIENT_TEST_SRC = \
+    rm_linux_client_test.c \
+    rm_linux_osal.c        \
     sockutils.c
 
+RM_DSP_CLIENT_TEST_SRC = \
+    rm_dsp_client_test.c \
+    sockutils.c    
+
 # FLAGS for the SourceFiles
 SRC_CFLAGS = -I. $(CFLAGS)
 
 # Make Rule for the SRC Files
 RM_SERVER_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_SERVER_SRC))
-RM_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_CLIENT_TEST_SRC))
+RM_LINUX_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_LINUX_CLIENT_TEST_SRC))
+RM_DSP_CLIENT_TEST_SRC_OBJS = $(patsubst %.c, $(ARMV7OBJDIR)/%.$(OBJEXT), $(RM_DSP_CLIENT_TEST_SRC))
 
-all:$(ARMV7BINDIR)/$(RM_SERVER_EXE) $(ARMV7BINDIR)/$(RM_CLIENT_TEST_EXE)
+all:$(ARMV7BINDIR)/$(RM_SERVER_EXE) $(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE) $(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE)
 
 $(ARMV7BINDIR)/$(RM_SERVER_EXE): $(RM_SERVER_SRC_OBJS) $(ARMV7BINDIR)/.created
        @echo linking $(RM_SERVER_SRC_OBJS) into $@ ...
        @$(CC) $(RM_SERVER_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
-$(ARMV7BINDIR)/$(RM_CLIENT_TEST_EXE): $(RM_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
-       @echo linking $(RM_CLIENT_TEST_SRC_OBJS) into $@ ...
-       @$(CC) $(RM_CLIENT_TEST_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
+$(ARMV7BINDIR)/$(RM_LINUX_CLIENT_TEST_EXE): $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
+       @echo linking $(RM_LINUX_CLIENT_TEST_SRC_OBJS) into $@ ...
+       @$(CC) $(RM_LINUX_CLIENT_TEST_SRC_OBJS) $(INTERNALLINKDEFS) -o $@
+$(ARMV7BINDIR)/$(RM_DSP_CLIENT_TEST_EXE): $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(ARMV7BINDIR)/.created
+       @echo linking $(RM_DSP_CLIENT_TEST_SRC_OBJS) into $@ ...
+       @$(CC) $(RM_DSP_CLIENT_TEST_SRC_OBJS) $(IPC_INTERNALLINKDEFS) -o $@     
 
 $(ARMV7OBJDIR)/%.$(OBJEXT): %.c $(ARMV7OBJDIR)/.created
        @echo compiling $< ...
diff --git a/test/k2k/armv7/linux/dspClientTest/dsp_client.c b/test/k2k/armv7/linux/dspClientTest/dsp_client.c
new file mode 100644 (file)
index 0000000..b157830
--- /dev/null
@@ -0,0 +1,1011 @@
+/*
+ *   dsp_client.c
+ *
+ *   DSP portion of Resource Manager ARM+DSP test that uses RPMSG and sockets to 
+ *   allow a DSP application to to request RM services from a RM Server running
+ *   from Linux User-space.
+ *
+ *  ============================================================================
+ *
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+/* Standard includes */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+/* XDC includes */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/System.h>
+
+/* BIOS includes */
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* IPC includes */
+#include <ti/ipc/MultiProc.h>
+#include <ti/ipc/HeapBufMP.h>
+#include <ti/ipc/MessageQ.h>
+
+/* CSL includes */
+#include <ti/csl/csl_chip.h>
+
+/* RM Includes */
+#include <ti/drv/rm/rm.h>
+#include <ti/drv/rm/rm_transport.h>
+#include <ti/drv/rm/rm_services.h>
+
+/**********************************************************************
+ ************************** RM Test Symbols ***************************
+ **********************************************************************/
+
+/* Test will run on this core */
+#define TEST_CORE                    0
+
+/* Test FALSE */
+#define RM_TEST_FALSE                0
+/* Test TRUE */
+#define RM_TEST_TRUE                 1
+
+/* RM packet heap name */
+#define MSGQ_HEAP_ID                 0
+
+/* MessageQ Name for DSP RM Client */
+#define CLIENT_MESSAGEQ_NAME         "RM_CLIENT"
+
+/* Size of RM static allocation response queue.  Must be greater than number of APPROVED
+ * static allocations */
+#define MAX_STATIC_ALLOCATION_RESPS  5 
+
+/* Size of RM service response queue */
+#define MAX_QUEUED_SERVICE_RESPONSES 10
+
+/* Error checking macro */
+#define ERROR_CHECK(checkVal, resultVal, rmInstName, printMsg)                   \
+    if (resultVal != checkVal) {                                                 \
+        char errorMsgToPrint[] = printMsg;                                       \
+        System_printf("Error Core %d : %s : ", coreNum, rmInstName);             \
+        System_printf("%s with error code : %d\n", errorMsgToPrint, resultVal);  \
+        testErrors++;                                                            \
+        System_abort("Test Failure\n");                                          \
+    }
+
+#define POSITIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check)  \
+    do {                                                                                            \
+        int32_t start = resStart;                                                                   \
+        int32_t alignment = align;                                                                  \
+        char    titleMsg[] = title;                                                                 \
+        System_printf ("Core %d : ---------------------------------------------------------\n",     \
+                       core);                                                                       \
+        System_printf ("Core %d : %s\n", core, titleMsg);                                           \
+        System_printf ("Core %d : - Instance Name: %-32s       -\n", core, instName);               \
+        System_printf ("Core %d : - Resource Name: %-32s       -\n", core, resName);                \
+        if (start == RM_RESOURCE_BASE_UNSPECIFIED) {                                                \
+            System_printf ("Core %d : - Start:         UNSPECIFIED                            -\n", \
+                           core);                                                                   \
+            System_printf ("Core %d : - Length:        %-16d                       -\n",            \
+                           core, resLen);                                                           \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - Start:         %-16d                       -\n",            \
+                           core, resStart);                                                         \
+            System_printf ("Core %d : - End:           %-16d                       -\n", core,      \
+                           (start + resLen - 1));                                                   \
+        }                                                                                           \
+        if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) {                                       \
+            System_printf ("Core %d : - Alignment:     UNSPECIFIED                            -\n", \
+                           core);                                                                   \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - Alignment:     %-16d                       -\n",            \
+                           core, alignment);                                                        \
+        }                                                                                           \
+        System_printf ("Core %d : -                                                       -\n",     \
+                       core);                                                                       \
+        if (state == check) {                                                                       \
+            System_printf ("Core %d : - PASSED                                                -\n", \
+                           core);                                                                   \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - FAILED - Denial: %-6d                               -\n",   \
+                           core, state);                                                            \
+            testErrors++;                                                                           \
+        }                                                                                           \
+        System_printf ("Core %d : ---------------------------------------------------------\n",     \
+                       core);                                                                       \
+        System_printf ("\n");                                                                       \
+    } while(0);
+
+#define NEGATIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check)  \
+    do {                                                                                            \
+        int32_t start = resStart;                                                                   \
+        int32_t alignment = align;                                                                  \
+        char    titleMsg[] = title;                                                                 \
+        System_printf ("Core %d : ---------------------------------------------------------\n",     \
+                       core);                                                                       \
+        System_printf ("Core %d : %s\n", core, titleMsg);                                           \
+        System_printf ("Core %d : - Instance Name: %-32s       -\n", core, instName);               \
+        System_printf ("Core %d : - Resource Name: %-32s       -\n", core, resName);                \
+        if (start == RM_RESOURCE_BASE_UNSPECIFIED) {                                                \
+            System_printf ("Core %d : - Start:         UNSPECIFIED                            -\n", \
+                           core);                                                                   \
+            System_printf ("Core %d : - Length:        %-16d                       -\n",            \
+                           core, resLen);                                                           \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - Start:         %-16d                       -\n",            \
+                           core, resStart);                                                         \
+            System_printf ("Core %d : - End:           %-16d                       -\n", core,      \
+                           (start + resLen - 1));                                                   \
+        }                                                                                           \
+        if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) {                                       \
+            System_printf ("Core %d : - Alignment:     UNSPECIFIED                            -\n", \
+                           core);                                                                   \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - Alignment:     %-16d                       -\n",            \
+                           core, alignment);                                                        \
+        }                                                                                           \
+        System_printf ("Core %d : -                                                       -\n",     \
+                       core);                                                                       \
+        if (state != check) {                                                                       \
+            System_printf ("Core %d : - PASSED - Denial: %-6d                               -\n",   \
+                           core, state);                                                            \
+        }                                                                                           \
+        else {                                                                                      \
+            System_printf ("Core %d : - FAILED - Expected Denial                              -\n", \
+                           core);                                                                   \
+            testErrors++;                                                                           \
+        }                                                                                           \
+        System_printf ("Core %d : ---------------------------------------------------------\n",     \
+                       core);                                                                       \
+        System_printf ("\n");                                                                       \
+    } while(0);    
+
+#define STATUS_PASS_CHECK(title, core, instName, resName, resStart, resLen, refCnt, state, check, expectRefCnt) \
+    do {                                                                                                        \
+        int32_t start = resStart;                                                                               \
+        char    titleMsg[] = title;                                                                             \
+        System_printf ("Core %d : ---------------------------------------------------------\n",                 \
+                       core);                                                                                   \
+        System_printf ("Core %d : %s\n", core, titleMsg);                                                       \
+        System_printf ("Core %d : - Instance Name: %-32s       -\n", core, instName);                           \
+        System_printf ("Core %d : - Resource Name: %-32s       -\n", core, resName);                            \
+        System_printf ("Core %d : - Start:         %-16d                       -\n",                            \
+                           core, resStart);                                                                     \
+        System_printf ("Core %d : - End:           %-16d                       -\n", core,                      \
+                           (start + resLen - 1));                                                               \
+        System_printf ("Core %d : - Expected Owner Count: %-16d                -\n",                            \
+                       core, expectRefCnt);                                                                     \
+        System_printf ("Core %d : - Returned Owner Count: %-16d                -\n",                            \
+                       core, refCnt);                                                                           \
+        System_printf ("Core %d : -                                                       -\n", core);          \
+        if ((state == check) && (refCnt == expectRefCnt)) {                                                     \
+            System_printf ("Core %d : - PASSED                                                -\n", core);      \
+        }                                                                                                       \
+        else {                                                                                                  \
+            if (refCnt != expectRefCnt) {                                                                       \
+                System_printf ("Core %d : - FAILED - Owner Count Mismatch                         -\n",         \
+                               core);                                                                           \
+            }                                                                                                   \
+            else {                                                                                              \
+                System_printf ("Core %d : - FAILED - Denial: %-6d                               -\n",           \
+                               core, state);                                                                    \
+            }                                                                                                   \
+            testErrors++;                                                                                       \
+        }                                                                                                       \
+        System_printf ("Core %d : ---------------------------------------------------------\n",                 \
+                       core);                                                                                   \
+        System_printf ("\n");                                                                                   \
+    } while(0);
+
+/**********************************************************************
+ ********************** RM Test Data Structures ***********************
+ **********************************************************************/
+
+/* IPC MessageQ RM packet encapsulation structure */
+typedef struct {
+    /* IPC MessageQ header (must be first element in structure) */
+    MessageQ_MsgHeader msgQHeader;
+    /* Pointer to RM packet */
+    Rm_Packet          rmPkt;
+} MsgQ_RmPacket;
+
+/**********************************************************************
+ ********************** Extern Variables ******************************
+ **********************************************************************/
+
+/* Alloc and free OSAL variables */
+extern uint32_t rmMallocCounter;
+extern uint32_t rmFreeCounter;
+
+/* RM test Static Policy provided to RM Client */
+extern const char rmStaticPolicy[];
+
+/**********************************************************************
+ ********************** Global Variables ******************************
+ **********************************************************************/
+
+/* Core number */
+uint16_t            coreNum;
+/* Number of errors that occurred during the test */
+uint16_t            testErrors;
+
+/* Task to configure application transport code for RM */
+Task_Handle         rmStartupTskHandle;
+/* High priority task for receiving RM packets */
+Task_Handle         rmReceiveTskHandle;
+/* RM client delegate and client test task */
+Task_Handle         rmClientTskHandle;
+
+/* Handle for heap that RM packets will be allocated from */
+HeapBufMP_Handle    rmPktHeapHandle = NULL;
+
+/* Client instance name (must match with RM Global Resource List (GRL) and policies */
+char                rmClientName[RM_NAME_MAX_CHARS] = "RM_Client";
+
+/* Client MessageQ */
+MessageQ_Handle     rmClientQ = NULL;
+
+/* Linux MessageQ ID */
+MessageQ_QueueId    linuxQueueId;
+
+/* Client instance handles */
+Rm_Handle           rmClientHandle = NULL;
+
+/* Client instance service handles */
+Rm_ServiceHandle   *rmClientServiceHandle = NULL;
+
+/* Client from Server transport handle */
+Rm_TransportHandle  clientFromServerTransportHandle;
+
+/* Static allocation response queue */
+Rm_ServiceRespInfo  staticResponseQueue[MAX_STATIC_ALLOCATION_RESPS];
+/* Static allocation response queue index */
+uint32_t            numStaticResponses;
+
+/* RM response info queue used to store service responses received via the callback function */
+Rm_ServiceRespInfo  responseInfoQueue[MAX_QUEUED_SERVICE_RESPONSES];
+
+/* RM resource names (must match resource node names in GRL and policies */
+char                resourceNameMemRegion[RM_NAME_MAX_CHARS]  = "memory-regions";
+char                resourceNameAccumCh[RM_NAME_MAX_CHARS]    = "accumulator-ch";
+char                resourceNameGpQ[RM_NAME_MAX_CHARS]        = "gp-queue";
+char                resourceNameAifQ[RM_NAME_MAX_CHARS]       = "aif-queue";
+char                resourceNameQosCluster[RM_NAME_MAX_CHARS] = "qos-cluster";
+char                resourceNameAifRxCh[RM_NAME_MAX_CHARS]    = "aif-rx-ch";
+char                resourceNameInfraQ[RM_NAME_MAX_CHARS]     = "infra-queue";
+
+/* Test RM NameServer name */
+char                nameServerNameFavQ[RM_NAME_MAX_CHARS]     = "My_Favorite_Queue";
+
+/**********************************************************************
+ *************************** Test Functions ***************************
+ **********************************************************************/
+
+Rm_Packet *transportAlloc(Rm_AppTransportHandle appTransport, uint32_t pktSize, Rm_PacketHandle *pktHandle)
+{
+    Rm_Packet     *rmPkt = NULL;
+    MsgQ_RmPacket *rmMsg = NULL;
+
+    /* Allocate a messageQ message for containing the RM packet */
+    rmMsg = (MsgQ_RmPacket *)MessageQ_alloc(MSGQ_HEAP_ID, sizeof(MsgQ_RmPacket));
+    if (rmMsg == NULL) {
+        System_printf("Error Core %d : MessageQ_alloc failed to allocate message: %d\n", coreNum);
+        testErrors++;
+        *pktHandle = NULL;
+        return(NULL);
+    }
+    else {
+        rmPkt = &(rmMsg->rmPkt);
+        rmPkt->pktLenBytes = pktSize;
+        *pktHandle = (Rm_PacketHandle)rmMsg;
+    }
+    return (rmPkt);    
+}
+
+void transportFree (MessageQ_Msg rmMsgQMsg)
+{
+    int32_t  status;
+
+    status = MessageQ_free(rmMsgQMsg);
+    if (status < 0) { 
+        System_printf("Error Core %d : MessageQ_free failed to free message: %d\n", coreNum, status);
+        testErrors++;
+    }        
+}
+
+int32_t transportSend (Rm_AppTransportHandle appTransport, Rm_PacketHandle pktHandle)
+{
+    MessageQ_QueueId *remoteQueueId = (MessageQ_QueueId *)appTransport;
+    MsgQ_RmPacket    *rmMsg = pktHandle;
+    int32_t           status;    
+    
+    /* Send the message to Linux */
+    status = MessageQ_put(*remoteQueueId, (MessageQ_Msg)rmMsg);
+    if (status < 0) {
+        System_printf("Error Core %d : MessageQ_put failed to send message: %d\n", coreNum, status);
+        testErrors++;
+    }
+    
+    return (0);
+}
+
+void transportReceive (void)
+{
+    int32_t          numPkts;
+    MessageQ_Msg     rmMsg = NULL;
+    Rm_Packet       *rmPkt = NULL;
+    int32_t          status;
+    uint32_t         i;  
+
+    /* Check if any packets available */
+    numPkts = (int32_t) MessageQ_count(rmClientQ);
+
+    /* Process all available packets */
+    for (i = 0; i < numPkts; i++) {
+        status = (int32_t) MessageQ_get(rmClientQ, &rmMsg, MessageQ_FOREVER);
+        if (rmMsg == NULL) {
+            System_printf("Error Core %d : MessageQ_get failed, returning a NULL packet\n", coreNum);
+            testErrors++;
+        }
+
+        /* Extract the Rm_Packet from the RM msg */
+        rmPkt = &(((MsgQ_RmPacket *)rmMsg)->rmPkt);
+
+        /* Provide packet to RM for processing */
+        if (status = Rm_receivePacket(clientFromServerTransportHandle, rmPkt)) {
+            System_printf("Error Core %d : RM failed to process received packet: %d\n", coreNum, status);
+            testErrors++;
+        }
+
+        /* Free RM packet buffer and messageQ message */
+        transportFree(rmMsg);
+    }
+}
+
+void serviceCallback(Rm_ServiceRespInfo *serviceResponse)
+{
+    uint32_t qIndex = 0;
+    
+    /* Populate next free entry in the responseInfoQueue */
+    while (responseInfoQueue[qIndex].serviceId != 0) {
+        qIndex++;
+        if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
+            qIndex = 0;
+        }
+    }
+
+    /* Save the response in the response queue for the test task to pick up */
+    memcpy((void *)&responseInfoQueue[qIndex], (void *)serviceResponse, sizeof(Rm_ServiceRespInfo));
+}
+
+/* Packets received via rpmsg port will issue callback vai transportReceive function */
+void waitForResponse(Rm_ServiceRespInfo *respInfo)
+{
+    uint32_t qIndex = 0;
+
+    if ((respInfo->serviceState == RM_SERVICE_PROCESSING) ||
+        (respInfo->serviceState == RM_SERVICE_PENDING_SERVER_RESPONSE)) {
+        /* Scan responseInfoQueue for the response received via the callback function */
+        while((responseInfoQueue[qIndex].serviceId != respInfo->serviceId) ||
+              (responseInfoQueue[qIndex].rmHandle != respInfo->rmHandle)) {            
+            qIndex++;
+            if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
+                qIndex = 0;
+            }
+
+            /* Higher priority receive task will retrieve response */
+        }  
+
+        memcpy((void *)respInfo, (void *)&responseInfoQueue[qIndex], sizeof(Rm_ServiceRespInfo));
+        memset((void *)&responseInfoQueue[qIndex], 0, sizeof(Rm_ServiceRespInfo));
+    }
+}
+
+void setRmRequest(Rm_ServiceReqInfo *reqInfo, Rm_ServiceType type, const char *resName, int32_t resBase,
+                  uint32_t resLen, int32_t resAlign, const char *nsName, int setCallback, Rm_ServiceRespInfo *respInfo)
+{                                                                                
+    memset((void *)reqInfo, 0, sizeof(Rm_ServiceReqInfo));                                        
+    reqInfo->type = type;                                                                           
+    reqInfo->resourceName = resName;                                                                
+    reqInfo->resourceBase = resBase;                                                                
+    reqInfo->resourceLength = resLen;                                                               
+    reqInfo->resourceAlignment = resAlign;                                                          
+    reqInfo->resourceNsName = nsName;
+    if (setCallback) {
+        reqInfo->callback.serviceCallback = serviceCallback;  
+    }
+    memset((void *)respInfo, 0, sizeof(Rm_ServiceRespInfo));                                     
+}
+
+void rmCleanupTsk(UArg arg0, UArg arg1)
+{
+    Rm_ServiceReqInfo  requestInfo;
+    Rm_ServiceRespInfo responseInfo;     
+    int32_t            result;
+    int32_t            finalMallocFree; 
+
+    /* Free all allocated resources */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAccumCh, 
+                 0, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAccumCh, 
+                 40, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameQosCluster, 
+                 0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);   
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameQosCluster, 
+                 2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifQ, 
+                 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);  
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifQ, 
+                 525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameInfraQ, 
+                 800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
+                 7000, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); 
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
+                 7011, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
+                 7010, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);   
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
+                 7005, 25, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
+                 0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); 
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
+                 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------------------- Resource Cleanup -------------------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+
+    /* Cleanup all service ports, transport handles, RM instances, and IPC constructs */
+    result = Rm_serviceCloseHandle(rmClientServiceHandle);
+    ERROR_CHECK(RM_OK, result, rmClientName, "Service handle close failed");
+
+    result = Rm_transportUnregister(clientFromServerTransportHandle);
+    ERROR_CHECK(RM_OK, result, rmClientName, "Unregister of Server transport failed");
+
+       result = MessageQ_delete(&rmClientQ);
+    if (result < 0) {
+        System_printf("Core %d : Error in MessageQ_delete [%d]\n", coreNum, result);
+        testErrors++;
+    }
+    result = Rm_delete(rmClientHandle, RM_TEST_TRUE);
+    ERROR_CHECK(RM_OK, result, rmClientName, "Instance delete failed");
+
+    System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
+    System_printf ("Core %d : ------------------ Memory Leak Check --------------------\n", coreNum);
+    System_printf ("Core %d : -                       : malloc count   |   free count -\n", coreNum);
+    System_printf ("Core %d : - Example Completion    :  %6d        |  %6d      -\n", coreNum,
+                   rmMallocCounter, rmFreeCounter);
+    finalMallocFree = rmMallocCounter - rmFreeCounter; 
+    if (finalMallocFree > 0) {
+        System_printf ("Core %d : - FAILED - %6d unfreed mallocs                       -\n",
+                       coreNum, finalMallocFree);
+        testErrors++;
+    }
+    else if (finalMallocFree < 0) {
+        System_printf ("Core %d : - FAILED - %6d more frees than mallocs               -\n",
+                       coreNum, -finalMallocFree);
+        testErrors++;
+    }
+    else {
+        System_printf ("Core %d : - PASSED                                                -\n",
+                       coreNum);
+    }
+    System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
+    System_printf ("\n");  
+
+    System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
+    System_printf ("Core %d : ------------------ Example Completion -------------------\n", coreNum);
+    if (testErrors) {
+        System_printf ("Core %d : - Test Errors: %-32d         -\n", coreNum, testErrors);
+    }
+    System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
+    System_printf ("\n"); 
+}
+
+/* Receive task has priority of 2 so that it pre-empts the RM instance test tasks */
+void rmReceiveTsk(UArg arg0, UArg arg1)
+{
+    while(1) {
+        transportReceive();
+        /* Sleep for 1ms so that the main test tasks can run */
+        Task_sleep(1);
+    }
+}
+
+void rmClientTsk(UArg arg0, UArg arg1)
+{
+    Rm_ServiceReqInfo  requestInfo;
+    Rm_ServiceRespInfo responseInfo;  
+    Task_Params        taskParams;
+    uint32_t           i, j;
+
+    /* Create new NameServer object */                
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_MAP_TO_NAME, resourceNameGpQ, 
+                 1002, 1, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("--------------- Create NameServer Object ----------------", 
+                        coreNum, rmClientName, resourceNameGpQ,
+                        requestInfo.resourceBase, responseInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); 
+
+    /* Retrieve a resource via a NameServer name */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_GET_BY_NAME, NULL, 
+                 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("------- Retrieve Resource Via NameServer Object ---------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        responseInfo.resourceBase, responseInfo.resourceLength, 
+                        0, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+
+    /* Allocate the resource returned from the NameServer request */
+    memset((void *)&requestInfo, 0, sizeof(Rm_ServiceReqInfo)); 
+    requestInfo.type = Rm_service_RESOURCE_ALLOCATE_INIT;
+    requestInfo.resourceName = responseInfo.resourceName;
+    requestInfo.resourceBase = responseInfo.resourceBase;
+    requestInfo.resourceLength = responseInfo.resourceLength;
+    requestInfo.resourceNsName = NULL;
+    requestInfo.callback.serviceCallback = serviceCallback;     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-------- Init Allocate Using Retrieved Resource ---------", 
+                        coreNum, rmClientName, responseInfo.resourceName,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+
+    /* Retrieve the resource status via the NameServer name */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, NULL, 
+                 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    STATUS_PASS_CHECK("---- Retrieve Resource Status Via NameServer Object -----", 
+                      coreNum, rmClientName, responseInfo.resourceName,
+                      responseInfo.resourceBase, responseInfo.resourceLength, 
+                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);  
+
+    /* Free resource via a NameServer name */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, NULL, 
+                 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("--- Free of Retrieved Resource Using NameServer Name ----", 
+                        coreNum, rmClientName, nameServerNameFavQ,
+                        0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    /* Delete the NameServer name */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_UNMAP_NAME, NULL, 
+                 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("--------------- Delete NameServer Object ----------------", 
+                        coreNum, rmClientName, nameServerNameFavQ,
+                        0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
+                 0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo);    
+    POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Use Allocate) --", 
+                        coreNum, rmClientName, resourceNameAifRxCh,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifRxCh, 
+                 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);        
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo);    
+    POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Init Allocate) -", 
+                        coreNum, rmClientName, resourceNameAifRxCh,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+    /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */
+
+    /* BEGIN testing allocations with UNSPECIFIED base and alignment values */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 5, 4, NULL, RM_TEST_TRUE, &responseInfo);        
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------", 
+                        coreNum, rmClientName, resourceNameAccumCh,
+                        RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 2, 1, NULL, RM_TEST_TRUE, &responseInfo);      
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo); 
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------", 
+                        coreNum, rmClientName, resourceNameAccumCh,
+                        RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 2, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("---- Use Allocation w/ UNSPECIFIED Base & Alignment -----", 
+                        coreNum, rmClientName, resourceNameAccumCh,
+                        RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
+                        RM_RESOURCE_ALIGNMENT_UNSPECIFIED, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+    /* END testing allocations with UNSPECIFIED base and alignment values */    
+
+    /* Allocate infrastructure queue shared between Linux kernel and Client */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ, 
+                 800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-- Init Allocation of Shared Linux and Client Resource --", 
+                        coreNum, rmClientName, resourceNameInfraQ,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    /* BEGIN Allocating some resources without providing a callback function.  RM should block and not return until the result
+     * is returned by the server. */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
+                 7000, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("- Init Allocation (RM Blocked Until Resource Returned) --", 
+                        coreNum, rmClientName, resourceNameGpQ,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
+                 7005, 25, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);  
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --", 
+                        coreNum, rmClientName, resourceNameGpQ,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
+                 7010, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo); 
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --", 
+                        coreNum, rmClientName, resourceNameGpQ,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+
+    /* Init allocation of resource already owned by Client should return approved and there should only
+     * be one instance of Client in resource's owner list. */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
+                 7011, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);  
+    waitForResponse(&responseInfo); 
+    POSITIVE_PASS_CHECK("----- Use Allocation of Owned Resource (RM Blocked) -----", 
+                        coreNum, rmClientName, resourceNameGpQ,
+                        requestInfo.resourceBase, requestInfo.resourceLength, 
+                        requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
+    /* END Allocating some resources without providing a callback function.  RM should block and not return
+     * until the result is returned by the Server. */   
+
+    /* BEGIN Getting the status of resources from Client and CD */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ, 
+                 7012, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo);  
+    STATUS_PASS_CHECK("-- Status Check of Resources from Client (Non-Blocking) -", 
+                      coreNum, rmClientName, responseInfo.resourceName,
+                      responseInfo.resourceBase, responseInfo.resourceLength, 
+                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);   
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ, 
+                 4025, 20, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    waitForResponse(&responseInfo);   
+    STATUS_PASS_CHECK("---- Status Check of Resources from Client (Blocking) ---", 
+                      coreNum, rmClientName, responseInfo.resourceName,
+                      responseInfo.resourceBase, responseInfo.resourceLength, 
+                      responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);  
+    /* END Getting the status of resources from Client and CD */    
+
+    /* Verify static allocations were validated.  Validation responses should have been received after the
+     * first service requests were made on the Client and CD post transport path registration. */
+    while (numStaticResponses > 0) {
+        /* Loop until all static request validations have been received */
+        for (i = 0; i < MAX_STATIC_ALLOCATION_RESPS; i++) {
+            if (staticResponseQueue[i].serviceId != 0) {            
+                for (j = 0; j < MAX_QUEUED_SERVICE_RESPONSES; j++) {
+                    if ((staticResponseQueue[i].serviceId == responseInfoQueue[j].serviceId) &&
+                        (staticResponseQueue[i].rmHandle == responseInfoQueue[j].rmHandle)) {                   
+                        POSITIVE_PASS_CHECK("------------- Static Allocation Validation --------------", 
+                                            coreNum, rmClientName, responseInfoQueue[j].resourceName,
+                                            responseInfoQueue[j].resourceBase, responseInfoQueue[j].resourceLength, 
+                                            0, responseInfoQueue[j].serviceState, 
+                                            RM_SERVICE_APPROVED); 
+                        memset((void *)&staticResponseQueue[i], 0, sizeof(Rm_ServiceRespInfo));
+                        memset((void *)&responseInfoQueue[j], 0, sizeof(Rm_ServiceRespInfo));
+                        numStaticResponses--;                        
+                        break;
+                    }
+                }
+            }
+        }    
+    }  
+
+    /* Create the RM cleanup task. */
+    System_printf("Core %d : Creating RM cleanup task...\n", coreNum);
+    Task_Params_init (&taskParams);
+    Task_create (rmCleanupTsk, &taskParams, NULL);
+}
+
+void rmStartupTsk(UArg arg0, UArg arg1)
+{
+    Task_Params      taskParams;  
+    Char             localQueueName[64];    
+    MessageQ_Msg     msg;
+    Rm_TransportCfg  rmTransCfg;
+    int32_t          rm_result;
+
+    /* Construct a MessageQ name adorned with core name: */
+    System_sprintf(localQueueName, "%s_%s", CLIENT_MESSAGEQ_NAME,
+                   MultiProc_getName(MultiProc_self()));
+
+    rmClientQ = MessageQ_create(localQueueName, NULL);
+    if (rmClientQ == NULL) {
+        System_abort("MessageQ_create failed\n");
+    }
+
+    if (coreNum == TEST_CORE) {
+        System_printf("Awaiting sync message from host...\n");
+        MessageQ_get(rmClientQ, &msg, MessageQ_FOREVER);
+        
+        linuxQueueId = MessageQ_getReplyQueue(msg);
+        MessageQ_put(linuxQueueId, msg);
+
+        /* Register the Server with the Client instance */
+        rmTransCfg.rmHandle = rmClientHandle;
+        rmTransCfg.appTransportHandle = (Rm_AppTransportHandle) &linuxQueueId;
+        rmTransCfg.remoteInstType = Rm_instType_SERVER;
+        rmTransCfg.transportCallouts.rmAllocPkt = transportAlloc;
+        rmTransCfg.transportCallouts.rmSendPkt = transportSend;
+        clientFromServerTransportHandle = Rm_transportRegister(&rmTransCfg, &rm_result);  
+
+        /* Create the RM receive task.  Assign higher priority than the test tasks so that
+         * when they spin waiting for messages from other RM instances the receive task is
+         * executed. */
+        System_printf("Core %d : Creating RM receive task...\n", coreNum);
+        Task_Params_init (&taskParams);
+        taskParams.priority = 2;
+        rmReceiveTskHandle = Task_create (rmReceiveTsk, &taskParams, NULL);
+
+        System_printf("Core %d : Creating RM client task...\n", coreNum);
+        Task_Params_init (&taskParams);
+        taskParams.priority = 1;
+        rmClientTskHandle = Task_create (rmClientTsk, &taskParams, NULL);
+    }
+}
+
+int main(int argc, char *argv[])
+{ 
+    Task_Params        taskParams;     
+    Rm_InitCfg         rmInitCfg;
+    Rm_ServiceReqInfo  requestInfo;
+    Rm_ServiceRespInfo responseInfo;
+    int32_t            result;
+
+
+    System_printf ("*********************************************************\n");
+    System_printf ("************ RM DSP+ARM DSP Client Testing **************\n");
+    System_printf ("*********************************************************\n");
+
+    System_printf ("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr());
+
+    coreNum = CSL_chipReadReg(CSL_CHIP_DNUM);
+
+    if (coreNum == TEST_CORE) {
+        testErrors = 0;  
+
+        /* Initialize the RM Client - RM must be initialized before anything else in the system */
+        memset(&rmInitCfg, 0, sizeof(rmInitCfg));
+        rmInitCfg.instName = rmClientName;
+        rmInitCfg.instType = Rm_instType_CLIENT;
+        rmInitCfg.instCfg.clientCfg.staticPolicy = (void *)rmStaticPolicy;
+        rmClientHandle = Rm_init(&rmInitCfg, &result);
+        ERROR_CHECK(RM_OK, result, rmClientName, "Initialization failed");
+
+        System_printf("\n\nInitialized %s\n\n", rmClientName);
+
+        /* Open Client service handle */
+        rmClientServiceHandle = Rm_serviceOpenHandle(rmClientHandle, &result);
+        ERROR_CHECK(RM_OK, result, rmClientName, "Service handle open failed");
+
+        /* Initialize the static allocation response queue */
+        for (numStaticResponses = 0; numStaticResponses < MAX_STATIC_ALLOCATION_RESPS; numStaticResponses++) {
+            memset((void *)&staticResponseQueue[numStaticResponses], 0, sizeof(Rm_ServiceRespInfo));
+        }
+        numStaticResponses = 0;
+
+        /* Static allocation tests */
+        setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
+                     0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);               
+        POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
+                            coreNum, rmClientName, resourceNameQosCluster,
+                            requestInfo.resourceBase, requestInfo.resourceLength, 
+                            requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
+        if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
+            memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
+        }        
+        
+        setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
+                     2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+        POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
+                            coreNum, rmClientName, resourceNameQosCluster,
+                            requestInfo.resourceBase, requestInfo.resourceLength, 
+                            requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
+        if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
+            memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
+        }           
+
+        /* Request resource from Client that can only be allocated to CD according to static policy */
+        setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
+                     1, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+        NEGATIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
+                            coreNum, rmClientName, resourceNameQosCluster,
+                            requestInfo.resourceBase, requestInfo.resourceLength, 
+                            requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);          
+
+        /* Request resource from both Client and CD that is shared according to static policy */
+        setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ, 
+                     525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
+        POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
+                            coreNum, rmClientName, resourceNameAifQ,
+                            requestInfo.resourceBase, requestInfo.resourceLength, 
+                            requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
+        if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
+            memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
+        }           
+
+        setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ, 
+                     525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
+        rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo); 
+        POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
+                            coreNum, rmClientName, resourceNameAifQ,
+                            requestInfo.resourceBase, requestInfo.resourceLength, 
+                            requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
+        if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
+            memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
+        }   
+
+    }
+    else {
+        System_printf("Core %d : RM DSP+ARM Linux test not executing on this core\n", coreNum);
+    }
+
+    /* Create the RM startup task */
+    System_printf("Core %d : Creating RM startup task...\n", coreNum);
+    Task_Params_init (&taskParams);
+    rmStartupTskHandle = Task_create (rmStartupTsk, &taskParams, NULL);
+
+    System_printf("Core %d : Starting BIOS...\n", coreNum);
+    BIOS_start();
+
+    return (0);    
+}
+
diff --git a/test/k2k/armv7/linux/dspClientTest/dsp_client.cfg b/test/k2k/armv7/linux/dspClientTest/dsp_client.cfg
new file mode 100644 (file)
index 0000000..e680265
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+xdc.loadCapsule("dsp_client.cfg.xs");
+
+var MessageQ  = xdc.useModule('ti.sdo.ipc.MessageQ');
+
+var VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+MessageQ.SetupTransportProxy = VirtioSetup;
+
+var NameServer = xdc.useModule("ti.sdo.utils.NameServer");
+var NsRemote = xdc.useModule("ti.ipc.namesrv.NameServerRemoteRpmsg");
+NameServer.SetupProxy = NsRemote;
+
+var TransportRpmsg = xdc.useModule('ti.ipc.transports.TransportRpmsg');
+
diff --git a/test/k2k/armv7/linux/dspClientTest/dsp_client.cfg.xs b/test/k2k/armv7/linux/dspClientTest/dsp_client.cfg.xs
new file mode 100644 (file)
index 0000000..16fa896
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * 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 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);
+
+if (Program.platformName.match(/6614/)) {
+    var VirtQueue = xdc.useModule('ti.ipc.family.tci6614.VirtQueue');
+    var Interrupt = xdc.useModule('ti.ipc.family.tci6614.Interrupt');
+
+    /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3"]);
+
+    Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+    Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+    Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+    var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+    Hwi.enableException = true;
+
+    /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
+       We assume the rest is to be left cacheable.
+       Per sprugw0b.pdf
+        0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
+        0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
+    */
+    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+    /*  This doesn't work:
+         Cache.MAR160_191 = 0xFFFFFFFC;
+         So, need to do this:
+    */
+    Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
+
+    Program.global.sysMinBufSize = 0x8000;
+    SysMin.bufSize  =  Program.global.sysMinBufSize;
+
+    /* Enable Memory Translation module that operates on the Resource Table */
+    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+    Resource.loadSegment = Program.platform.dataMemory;
+
+    /*  COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
+    /*
+    Diags.setMaskMeta("ti.ipc.family.tci6614.Interrupt", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.family.tci6614.VirtQueue", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
+        Diags.INFO|Diags.USER1|Diags.STATUS,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
+        Diags.ALWAYS_ON);
+    */
+}
+else if (Program.platformName.match(/simKepler/) ||
+        Program.cpu.deviceName.match(/^TMS320TCI6638$/)) {
+    var VirtQueue = xdc.useModule('ti.ipc.family.tci6638.VirtQueue');
+    var Interrupt = xdc.useModule('ti.ipc.family.tci6638.Interrupt');
+
+    /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
+    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+    MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3",
+                               "CORE4", "CORE5", "CORE6", "CORE7"]);
+    Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
+    Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
+    Program.sectMap[".text:_c_int00"].loadAlign = 0x400;
+
+    var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
+    Hwi.enableException = true;
+
+    /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
+       We assume the rest is to be left cacheable.
+       Per sprugw0b.pdf
+        0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
+        0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
+    */
+    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
+    /*  This doesn't work:
+         Cache.MAR160_191 = 0xFFFFFFFC;
+         So, need to do this:
+    */
+    /* TBD: Update for Kepler: */
+    Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);
+
+    Program.global.sysMinBufSize = 0x8000;
+    SysMin.bufSize  =  Program.global.sysMinBufSize;
+
+    /* Enable Memory Translation module that operates on the Resource Table */
+    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+    Resource.loadSegment = Program.platform.dataMemory;
+
+    /*  COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
+    /*
+    Diags.setMaskMeta("ti.ipc.family.tci6638.Interrupt", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.family.tci6638.VirtQueue", Diags.USER1,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
+        Diags.INFO|Diags.USER1|Diags.STATUS,
+        Diags.ALWAYS_ON);
+    Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
+        Diags.ALWAYS_ON);
+    */
+}
+else {
+    throw("messageq_common.cfg.xs: Did not match any platform!");
+}
+
+Hwi.enableException = true;
+
+xdc.loadPackage('ti.ipc.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 VirtioSetup = xdc.useModule('ti.ipc.transports.TransportRpmsgSetup');
+VirtioSetup.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';
+
+/* PDK packages */
+var devType = "k2k"
+var Csl = xdc.useModule('ti.csl.Settings');
+Csl.deviceType = devType;
+var Rm = xdc.loadPackage('ti.drv.rm'); 
+
diff --git a/test/k2k/armv7/linux/rm_dsp_client_test.c b/test/k2k/armv7/linux/rm_dsp_client_test.c
new file mode 100644 (file)
index 0000000..d54fa50
--- /dev/null
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * *  Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * *  Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * *  Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/*
+ *  ======== rm_dsp_client_test.c ========
+ *
+ *  Works with the dspClientTest DSP application over the rpmsg-proto socket.
+ */
+
+/* Standard headers */
+#include <stdio.h>
+#include <stdlib.h>
+
+/* IPC Headers */
+#include <Std.h>
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/MessageQ.h>
+
+/* Socket Includes */
+#include "sockutils.h"
+#include "sockrmmsg.h"
+
+/* RM includes */
+#include <ti/drv/rm/rm_transport.h>
+
+/* App defines:  Must match on remote proc side: */
+#define HEAPID               0u
+#define CLIENT_MESSAGEQ_NAME "RM_CLIENT"
+#define SERVER_MESSAGEQ_NAME "RM_SERVER"
+
+#define PROC_ID_DEFAULT      1     /* Host is zero, remote cores start at 1 */
+
+/* IPC MessageQ RM packet encapsulation structure */
+typedef struct {
+    /* IPC MessageQ header (must be first element in structure) */
+    MessageQ_MsgHeader msgQHeader;
+    /* Pointer to RM packet */
+    Rm_Packet          rmPkt;
+} MsgQ_RmPacket;
+
+Int rmServerExchange_execute(UInt16 procId)
+{
+    int32_t           status = 0;
+    int               err;
+    MessageQ_Msg      msg = NULL;
+    MessageQ_Params   msgParams;
+    MessageQ_QueueId  queueId = MessageQ_INVALIDMESSAGEQ;
+    MessageQ_Handle   msgqHandle;
+    char              remoteQueueName[64];
+    MessageQ_Msg      rmMsg;
+    Rm_Packet        *rmPkt;
+    int               rm_pkt_len;
+    sock_h            sock_to_server;
+    sock_name_t       local_sock_name;
+    sock_name_t       server_sock;
+    sock_name_t       server_sock_addr;
+    struct sockaddr_un  server_addr;
+    char              client_ex_sock_name[] = "/tmp/var/run/rm/rm_dsp_client_exchange";
+    char              server_sock_name[] = RM_SERVER_SOCKET_NAME;    
+
+    printf("Entered rmServerExchange_execute\n");
+    /* Create the local Message Queue for receiving from DSP Client. */
+    MessageQ_Params_init(&msgParams);
+    msgqHandle = MessageQ_create(SERVER_MESSAGEQ_NAME, &msgParams);
+    if (msgqHandle == NULL) {
+       printf("Error in MessageQ_create\n");
+       goto exit;
+    }
+    else {
+       printf("Local MessageQId: 0x%x\n", MessageQ_getQueueId(msgqHandle));
+    }
+
+    sprintf(remoteQueueName, "%s_%s", CLIENT_MESSAGEQ_NAME,
+            MultiProc_getName(procId));
+
+    /* Poll until remote side has it's messageQ created before we send: */
+    do {
+       status = MessageQ_open(remoteQueueName, &queueId);
+       sleep (1);
+    } while (status == MessageQ_E_NOTFOUND);
+
+    if (status < 0) {
+       printf("Error in MessageQ_open [%d]\n", status);
+       goto cleanup;
+    }
+    else {
+       printf("Remote queueId  [0x%x]\n", queueId);
+    }
+
+    msg = MessageQ_alloc(HEAPID, sizeof(MessageQ_MsgHeader));
+    if (msg == NULL) {
+       printf("Error in MessageQ_alloc\n");
+       MessageQ_close(&queueId);
+       goto cleanup;
+    }
+
+    /* handshake with DSP client so that it knows Linux's receive Q */
+    MessageQ_setReplyQueue(msgqHandle, msg);
+    MessageQ_put(queueId, msg);
+    MessageQ_get(msgqHandle, &msg, MessageQ_FOREVER);
+    MessageQ_free(msg);
+
+    printf("Setting up socket connection with RM Server\n");
+
+    /* open local sock for communication to RM Server */
+    local_sock_name.type = sock_name_e;
+       local_sock_name.s.name = client_ex_sock_name;
+    sock_to_server = sock_open(&local_sock_name);
+    if (!sock_to_server) {
+       printf("Local socket to RM Server open failed\n");
+       return -1;
+    }
+    /* RM Server sock */
+    server_sock.type = sock_name_e;
+    server_sock.s.name = server_sock_name;
+
+    printf("Waiting for RM messages from DSP Client\n");
+
+    while(1) {
+        status = MessageQ_get(msgqHandle, &rmMsg, MessageQ_FOREVER);
+        if (status < 0) {
+            printf("Error in MessageQ_get [%d]\n", status);
+            break;
+        }
+
+        rmPkt = &(((MsgQ_RmPacket *)rmMsg)->rmPkt);
+        printf("Received RM pkt of size %d from DSP client\n", rmPkt->pktLenBytes);
+
+        /* Send received data to RM Server */
+        if (sock_send(sock_to_server, (char *)rmPkt, sizeof(*rmPkt), &server_sock)) {
+           printf("Failed to send data to RM Server\n");
+        }
+
+        /* Wait for response from RM Server */
+        rm_pkt_len = 0;
+        err = sock_wait(sock_to_server, &rm_pkt_len, NULL, -1);
+        if (err == -2) {
+           /* Timeout */
+           printf("Error socket timeout\n");
+           return -1;
+        }
+        else if (err < 0) {
+           printf("Error in reading from socket, error %d\n", err);
+           return -1;
+        }        
+
+        server_sock_addr.type = sock_addr_e;
+        server_sock_addr.s.addr = &server_addr;
+        err = sock_recv(sock_to_server, (char *)rmPkt, rm_pkt_len, &server_sock_addr);
+        if (err != rm_pkt_len) {
+           printf("recv RM pkt failed from socket, received = %d, expected = %d\n",
+                  err, rm_pkt_len);
+           return;
+        }
+
+        /* send back to DSP */
+        status = MessageQ_put(queueId, rmMsg);
+        if (status < 0) {
+            printf("Error in MessageQ_put [%d]\n", status);
+            break;
+        }
+    }
+
+cleanup:
+    /* Clean-up */
+    status = MessageQ_delete(&msgqHandle);
+    if (status < 0) {
+        printf("Error in MessageQ_delete [%d]\n", status);
+    }
+
+exit:
+    printf("Leaving rmServerExchange_execute\n\n");
+
+    return 0;
+}
+
+int main (int argc, char ** argv)
+{
+    Int32 status = 0;
+    UInt16 procId = PROC_ID_DEFAULT;
+
+    /* Parse Args: */
+    switch (argc) {
+        case 1:
+           /* use defaults */
+           break;
+        case 2:
+           procId = atoi(argv[2]);
+           break;
+        default:
+           printf("Usage: %s [<ProcId>]\n", argv[0]);
+           printf("\tDefaults: ProcId: %d\n", PROC_ID_DEFAULT);
+           exit(0);
+    }
+    if (procId >= MultiProc_getNumProcessors()) {
+        printf("ProcId must be less than %d\n", MultiProc_getNumProcessors());
+        exit(0);
+    }
+    printf("Using procId : %d\n", procId);
+
+    status = Ipc_start();
+
+    if (status >= 0) {
+        rmServerExchange_execute(procId);
+        Ipc_stop();
+    }
+    else {
+        printf("Ipc_start failed: status = %d\n", status);
+    }
+
+    return(0);   
+}
index 691e60e43cd7ff4ccc801ed03c90e2ec98a4ebc5..0445f5aad55e1eb22821520f69f8c584337de12b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *   rm_arm_test.c
+ *   rm_linux_client_test.c
  *
  *   Multi-process Resource Manager test that uses sockets to allow a Linux
  *   User-space application to request RM services from a RM Server, 
@@ -817,10 +817,6 @@ void client_test(void)
             }
         }    
     }  
-
-#if PRINT_USED_RESOURCES
-    Rm_resourceStatus(rmCdHandle, RM_TEST_TRUE);
-#endif
 }
 
 void connection_setup(void)
diff --git a/test/k2k/c66/bios/rmK2KArmv7LinuxDspClientTestProject.txt b/test/k2k/c66/bios/rmK2KArmv7LinuxDspClientTestProject.txt
new file mode 100644 (file)
index 0000000..288e633
--- /dev/null
@@ -0,0 +1,8 @@
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2k/armv7/linux/dspClientTest/dsp_client.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/static-policy.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2k/c66/bios/rm_osal.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2k/armv7/linux/dspClientTest/dsp_client.cfg"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2k/armv7/linux/dspClientTest/dsp_client.cfg.xs"
+-ccs.setCompilerOptions "-mv6600 -g -DDEVICE_K2K --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm" 
+-rtsc.enableRtsc
+