]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/commitdiff
Created test project to check for memory leaks in RM (work in progress)
authorJustin Sobota <jsobota@ti.com>
Tue, 26 Mar 2013 22:15:11 +0000 (18:15 -0400)
committerJustin Sobota <jsobota@ti.com>
Tue, 26 Mar 2013 22:15:11 +0000 (18:15 -0400)
test/k2h/c66/bios/rmK2HC66BiosMemTestProject.txt [new file with mode: 0644]
test/k2h/c66/bios/rm_mem_test.cfg [new file with mode: 0644]
test/k2k/c66/bios/rmK2KC66BiosMemTestProject.txt [new file with mode: 0644]
test/k2k/c66/bios/rm_mem_test.cfg [new file with mode: 0644]
test/rm_mem_test.c [new file with mode: 0644]
test/rm_transport_setup.c

diff --git a/test/k2h/c66/bios/rmK2HC66BiosMemTestProject.txt b/test/k2h/c66/bios/rmK2HC66BiosMemTestProject.txt
new file mode 100644 (file)
index 0000000..517fe6c
--- /dev/null
@@ -0,0 +1,9 @@
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/rm_mem_test.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/device/k2h/global-resource-list.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/device/k2h/policy_dsp_arm.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/rm_transport_setup.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/rm_osal.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/c66/bios/rm_mem_test.cfg"
+-ccs.setCompilerOptions "-mv6600 -g -DDEVICE_K2H --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm" 
+-rtsc.enableRtsc
+
diff --git a/test/k2h/c66/bios/rm_mem_test.cfg b/test/k2h/c66/bios/rm_mem_test.cfg
new file mode 100644 (file)
index 0000000..1119c5e
--- /dev/null
@@ -0,0 +1,106 @@
+/* 
+ * 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 MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+/*
+ *  Get the list of names that the build device supports.
+ *  I.e. ["CORE0", "CORE1", "CORE2" ... ]
+ */
+var nameList = ["CORE0", "CORE1"];
+
+/* 
+ *  Since this is a single-image example, we don't (at build-time) which 
+ *  processor we're building for.  We therefore supply 'null' 
+ *  as the local procName and allow IPC to set the local procId at runtime.
+ */
+MultiProc.setConfig(null, nameList);
+                           
+/* 
+ *  The SysStd System provider is a good one to use for debugging 
+ *  but does not have the best performance. Use xdc.runtime.SysMin
+ *  for better performance.
+ */
+var System   = xdc.useModule('xdc.runtime.System');
+var SysStd   = xdc.useModule('xdc.runtime.SysStd');
+System.SupportProxy = SysStd;
+
+/* Modules explicitly used in the application */
+var MessageQ    = xdc.useModule('ti.sdo.ipc.MessageQ');
+var Ipc         = xdc.useModule('ti.sdo.ipc.Ipc');
+var HeapBufMP   = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
+var MultiProc   = xdc.useModule('ti.sdo.utils.MultiProc');
+
+/* BIOS/XDC modules */
+var BIOS        = xdc.useModule('ti.sysbios.BIOS');
+BIOS.heapSize   = 0x10000;
+var Task        = xdc.useModule('ti.sysbios.knl.Task');
+
+Program.sectMap[".sharedGRL"] = new Program.SectionSpec();
+Program.sectMap[".sharedGRL"] = "L2SRAM";
+
+Program.sectMap[".sharedPolicy"] = new Program.SectionSpec();
+Program.sectMap[".sharedPolicy"] = "L2SRAM";
+
+Program.sectMap[".rm"] = new Program.SectionSpec();
+Program.sectMap[".rm"] = "MSMCSRAM";
+
+/* Synchronize all processors (this will be done in Ipc_start) */
+Ipc.procSync = Ipc.ProcSync_ALL;
+
+/* Shared Memory base address and length */
+var SHAREDMEM           = 0x0C000000;
+var SHAREDMEMSIZE       = 0x00100000;
+
+/* 
+ *  Need to define the shared region. The IPC modules use this
+ *  to make portable pointers. All processors need to add this
+ *  call with their base address of the shared memory region.
+ *  If the processor cannot access the memory, do not add it.
+ */ 
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+SharedRegion.translate = false;
+SharedRegion.setEntryMeta(0,
+    { base: SHAREDMEM, 
+      len:  SHAREDMEMSIZE,
+      ownerProcId: 0,
+      isValid: true,
+      name: "DDR2 RAM",
+    });
+
+/* 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/k2k/c66/bios/rmK2KC66BiosMemTestProject.txt b/test/k2k/c66/bios/rmK2KC66BiosMemTestProject.txt
new file mode 100644 (file)
index 0000000..2747125
--- /dev/null
@@ -0,0 +1,9 @@
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/rm_mem_test.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/device/k2k/global-resource-list.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/device/k2k/policy_dsp_arm.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/rm_transport_setup.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/rm_osal.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2k/c66/bios/rm_mem_test.cfg"
+-ccs.setCompilerOptions "-mv6600 -g -DDEVICE_K2K --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm" 
+-rtsc.enableRtsc
+
diff --git a/test/k2k/c66/bios/rm_mem_test.cfg b/test/k2k/c66/bios/rm_mem_test.cfg
new file mode 100644 (file)
index 0000000..fc9b639
--- /dev/null
@@ -0,0 +1,106 @@
+/* 
+ * 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 MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
+
+/*
+ *  Get the list of names that the build device supports.
+ *  I.e. ["CORE0", "CORE1", "CORE2" ... ]
+ */
+var nameList = ["CORE0", "CORE1"];
+
+/* 
+ *  Since this is a single-image example, we don't (at build-time) which 
+ *  processor we're building for.  We therefore supply 'null' 
+ *  as the local procName and allow IPC to set the local procId at runtime.
+ */
+MultiProc.setConfig(null, nameList);
+                           
+/* 
+ *  The SysStd System provider is a good one to use for debugging 
+ *  but does not have the best performance. Use xdc.runtime.SysMin
+ *  for better performance.
+ */
+var System   = xdc.useModule('xdc.runtime.System');
+var SysStd   = xdc.useModule('xdc.runtime.SysStd');
+System.SupportProxy = SysStd;
+
+/* Modules explicitly used in the application */
+var MessageQ    = xdc.useModule('ti.sdo.ipc.MessageQ');
+var Ipc         = xdc.useModule('ti.sdo.ipc.Ipc');
+var HeapBufMP   = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP');
+var MultiProc   = xdc.useModule('ti.sdo.utils.MultiProc');
+
+/* BIOS/XDC modules */
+var BIOS        = xdc.useModule('ti.sysbios.BIOS');
+BIOS.heapSize   = 0x10000;
+var Task        = xdc.useModule('ti.sysbios.knl.Task');
+
+Program.sectMap[".sharedGRL"] = new Program.SectionSpec();
+Program.sectMap[".sharedGRL"] = "L2SRAM";
+
+Program.sectMap[".sharedPolicy"] = new Program.SectionSpec();
+Program.sectMap[".sharedPolicy"] = "L2SRAM";
+
+Program.sectMap[".rm"] = new Program.SectionSpec();
+Program.sectMap[".rm"] = "MSMCSRAM";
+
+/* Synchronize all processors (this will be done in Ipc_start) */
+Ipc.procSync = Ipc.ProcSync_ALL;
+
+/* Shared Memory base address and length */
+var SHAREDMEM           = 0x0C000000;
+var SHAREDMEMSIZE       = 0x00100000;
+
+/* 
+ *  Need to define the shared region. The IPC modules use this
+ *  to make portable pointers. All processors need to add this
+ *  call with their base address of the shared memory region.
+ *  If the processor cannot access the memory, do not add it.
+ */ 
+var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
+SharedRegion.translate = false;
+SharedRegion.setEntryMeta(0,
+    { base: SHAREDMEM, 
+      len:  SHAREDMEMSIZE,
+      ownerProcId: 0,
+      isValid: true,
+      name: "DDR2 RAM",
+    });
+
+/* 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/rm_mem_test.c b/test/rm_mem_test.c
new file mode 100644 (file)
index 0000000..868842b
--- /dev/null
@@ -0,0 +1,1001 @@
+/*
+ *   rm_test.c
+ *
+ *   Multicore Resource Manager test that uses IPC to an application
+ *   requesting RM services from a RM Server, Client Delegate, and Client.
+ *
+ *  ============================================================================
+ *
+ * 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 <string.h>
+
+/* XDC Includes */
+#include <xdc/std.h>
+#include <xdc/runtime/System.h>
+
+/* IPC Includes */
+#include <ti/ipc/Ipc.h>
+#include <ti/ipc/GateMP.h>
+
+/* BIOS Includes */
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+/* CSL Includes */
+#include <ti/csl/csl_chip.h>
+#include <ti/csl/csl_cacheAux.h>
+#include <ti/csl/csl_xmcAux.h>
+
+/* RM Includes */
+#include <ti/drv/rm/rm.h>
+#include <ti/drv/rm/rm_transport.h>
+#include <ti/drv/rm/rm_services.h>
+#include <ti/drv/rm/rm_osal.h>
+
+/**********************************************************************
+ ************************** RM Test Symbols ***************************
+ **********************************************************************/
+
+#define SYSINIT                      0
+#define NUM_CORES                    2
+
+/* Test FALSE */
+#define RM_TEST_FALSE                0
+/* Test TRUE */
+#define RM_TEST_TRUE                 1
+
+/* Name of GateMP used to synchronize the RM test tasks */
+#define RM_TASK_GATE_NAME            "rmGateMP"
+
+/* Size of RM service response queue */
+#define MAX_QUEUED_SERVICE_RESPONSES 10
+
+/**********************************************************************
+ ********************** Extern Variables ******************************
+ **********************************************************************/
+
+/* RM test Global Resource List (GRL) */
+extern const char rmGlobalResourceList[];
+/* RM test Global Policy provided to RM Server */
+extern const char rmDspPlusArmPolicy[];
+
+/* Alloc and free OSAL variables */
+extern uint32_t rmMallocCounter;
+extern uint32_t rmFreeCounter;
+
+extern void Osal_rmBeginMemAccess(void *ptr, uint32_t size);
+extern void Osal_rmEndMemAccess(void *ptr, uint32_t size);
+
+extern int setupRmTransConfig(uint32_t numTestCores, uint32_t systemInitCore, Task_FuncPtr testTask);
+extern int deleteRmTrans(void);
+
+/**********************************************************************
+ ********************** Global Variables ******************************
+ **********************************************************************/
+
+/* DSP core number according to IPC */
+uint16_t            coreNum;
+
+/* Task to configure application transport code for RM */
+Task_Handle         rmStartupTskHandle;
+/* RM server test task */
+Task_Handle         rmServerTskHandle;
+/* RM client delegate and client test task */
+Task_Handle         rmClientTskHandle;
+
+/* GateMP used to synchronize tests between the two RM test tasks */
+GateMP_Handle       gateHandle = NULL;
+/* GateMP key */
+IArg                gateKey;
+
+/* RM instance variables */
+Rm_Handle           rmHandle = NULL;
+char                rmInstName[RM_NAME_MAX_CHARS];
+
+/* Malloc/Free tracking variables */
+uint32_t            sMalloc, mMalloc;
+uint32_t            sFree, mFree;
+
+/* 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                resourceNameGpQ[RM_NAME_MAX_CHARS]        = "GENERAL_PURPOSE_QUEUE-qm1";
+
+/* Test RM NameServer name */
+char                nameServerNameFavQ[RM_NAME_MAX_CHARS]     = "My_Favorite_Queue";
+
+/* RM initialization sync point */
+#pragma DATA_SECTION (isRmInitialized, ".rm");
+#pragma DATA_ALIGN (isRmInitialized, 128)
+volatile int8_t   isRmInitialized[128];
+
+/**********************************************************************
+ ***************************** Test Macros ****************************
+ **********************************************************************/
+
+/* 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);  \
+        System_abort("Test Failure\n");                                          \
+    }
+
+#define MEM_PRE_PRINT(title, apiOrFunc)                                                     \
+    do {                                                                                    \
+        char titleMsg[] = title;                                                            \
+        char apiOrFuncMsg[] = apiOrFunc;                                                    \
+                                                                                            \
+        sMalloc = rmMallocCounter;                                                          \
+        sFree   = rmFreeCounter;                                                            \
+        System_printf ("---------------------------------------------------------\n");      \
+        System_printf ("%s\n", titleMsg);                                                   \
+        System_printf ("- API/Functionality     : malloc count   |   free count -\n");      \
+        System_printf ("- %s :  %6d        |  %6d      -\n", apiOrFuncMsg, sMalloc, sFree); \
+    } while(0)
+
+#define MEM_MID_PRINT(apiOrFunc)                                                            \
+    do {                                                                                    \
+        char apiOrFuncMsg[] = apiOrFunc;                                                    \
+                                                                                            \
+        mMalloc = rmMallocCounter;                                                          \
+        mFree   = rmFreeCounter;                                                            \
+        System_printf ("- %s :  %6d        |  %6d      -\n", apiOrFuncMsg, mMalloc, mFree); \
+    } while(0)
+
+#define MEM_END_PRINT(apiOrFunc)                                                           \
+    do {                                                                                   \
+        char    apiOrFuncMsg[] = apiOrFunc;                                                \
+        int32_t mallocFreeBalance = (rmMallocCounter - sMalloc) - (rmFreeCounter - sFree); \
+                                                                                           \
+        System_printf ("- %s :  %6d        |  %6d      -\n",                               \
+                       apiOrFuncMsg, rmMallocCounter, rmFreeCounter);                      \
+        if (mallocFreeBalance > 0) {                                                       \
+            System_printf ("- FAILED - %6d unfreed mallocs                       -\n",     \
+                           mallocFreeBalance);                                             \
+        }                                                                                  \
+        else if (mallocFreeBalance < 0) {                                                  \
+            System_printf ("- FAILED - %6d more frees than mallocs               -\n",     \
+                           -mallocFreeBalance);                                            \
+        }                                                                                  \
+        else {                                                                             \
+            System_printf ("- PASSED                                                -\n"); \
+        }                                                                                  \
+        System_printf ("---------------------------------------------------------\n");     \
+        System_printf ("\n");                                                              \
+    } while(0)
+
+/**********************************************************************
+ *************************** Test Functions ***************************
+ **********************************************************************/
+
+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(responseInfoQueue[qIndex]));
+}
+
+void waitForResponse(Rm_ServiceRespInfo *respInfo)
+{
+    uint32_t qIndex = 0;
+
+    if (respInfo->serviceState == RM_SERVICE_PROCESSING) {
+        /* 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(*respInfo));
+        memset((void *)&responseInfoQueue[qIndex], 0, sizeof(responseInfoQueue[qIndex]));
+    }
+}
+
+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(*reqInfo));                                        
+    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(*respInfo));                                     
+}
+
+void rmCleanupTsk(UArg arg0, UArg arg1)
+{
+    int32_t rmResult;
+    
+    /* Delete the RM test tasks */
+    System_printf("Core %d: Deleting RM startup task...\n", coreNum);
+    if (rmStartupTskHandle) {
+       Task_delete(&rmStartupTskHandle);
+       /* Set the task handle to be NULL so that the delete only occurs once */
+       rmStartupTskHandle = NULL;
+    }  
+    
+    if (coreNum == SYSINIT) {
+        if (rmServerTskHandle) {
+            System_printf("Core %d: Deleting RM server task...\n", coreNum);
+            Task_delete(&rmServerTskHandle);
+            /* Set the task handle to be NULL so that the delete only occurs once */
+            rmServerTskHandle = NULL;
+        }
+    }
+    else {
+        if (rmClientTskHandle) {
+            System_printf("Core %d: Deleting RM client task...\n", coreNum);        
+            Task_delete(&rmClientTskHandle);
+            /* Set the task handle to be NULL so that the delete only occurs once */
+            rmClientTskHandle = NULL;
+        }
+    }
+
+    deleteRmTrans();
+
+    rmResult = Rm_delete(rmHandle, RM_TEST_TRUE);
+    ERROR_CHECK(RM_OK, rmResult, rmInstName, "Delete failed");
+
+    BIOS_exit(0);
+}
+
+void rmServerTsk(UArg arg0, UArg arg1)
+{
+    Rm_ServiceHandle   *serviceHandle;
+    Rm_ServiceReqInfo   requestInfo;
+    Rm_ServiceRespInfo  responseInfo;
+    Task_Params         taskParams;
+    int32_t             rmResult;
+
+    /* Open Client service handle */
+    serviceHandle = Rm_serviceOpenHandle(rmHandle, &rmResult);
+    ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle open failed");
+
+    Rm_instanceStatus(rmHandle);
+
+#if 0
+    /* BEGIN testing UNSPECIFIED base and alignment requests on Server */               
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);       
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
+                                                                                                  rmInstName,
+                                                                                                  resourceNameGpQ,
+                                                                                                  requestInfo.resourceLength, 
+                                                                                                  requestInfo.resourceAlignment);
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }    
+               
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 1, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);  
+    System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length UNSPECIFIED alignment : ", coreNum,
+                                                                                                           rmInstName,
+                                                                                                           resourceNameGpQ,
+                                                                                                           requestInfo.resourceLength);
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }     
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 1, 200, NULL, RM_TEST_TRUE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
+                                                                                                  rmInstName,
+                                                                                                  resourceNameGpQ,
+                                                                                                  requestInfo.resourceLength,
+                                                                                                  requestInfo.resourceAlignment);
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }      
+    /* END testing UNSPECIFIED base and alignment requests on Server */      
+
+    /* Create new NameServer object */                
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_MAP_TO_NAME, resourceNameGpQ, 
+                 1002, 1, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo); 
+    System_printf("Core %d : %s create name %s tied to %s %d - %d : ", coreNum,
+                                                                       rmInstName,
+                                                                       nameServerNameFavQ,
+                                                                       responseInfo.resourceName,
+                                                                       requestInfo.resourceBase, 
+                                                                       (requestInfo.resourceBase + requestInfo.resourceLength - 1));                                                                       
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }     
+
+    /* Wait for CD and Client retrieve resource via name, allocate the resource, free resource via name, and 
+     * delete the NameServer object. */
+    gateKey = GateMP_enter(gateHandle);
+    GateMP_leave(gateHandle, gateKey);
+
+    /* Try to allocate the memory region taken by the Linux Kernel and not specified as shared */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameMemRegion, 
+                 12, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo); 
+    System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
+                                                                  rmInstName,
+                                                                  resourceNameMemRegion,
+                                                                  requestInfo.resourceBase, 
+                                                                  (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState != RM_SERVICE_APPROVED) {        
+        System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
+    }
+    else {
+        System_printf("FAILED : expected denial or error\n");
+    }    
+
+    /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
+                 14, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);       
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
+                                                                  rmInstName,
+                                                                  resourceNameAifRxCh,
+                                                                  requestInfo.resourceBase, 
+                                                                  (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    } 
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
+                 19, 31, 0, NULL, RM_TEST_TRUE, &responseInfo);      
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
+                                                                  rmInstName,
+                                                                  resourceNameAifRxCh,
+                                                                  requestInfo.resourceBase, 
+                                                                  (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }        
+    
+    /* Wait for Client and Client Delegate to do their allocations */
+    gateKey = GateMP_enter(gateHandle);
+    GateMP_leave(gateHandle, gateKey);       
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
+                 25, 3, 0, NULL, RM_TEST_TRUE, &responseInfo);      
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);  
+    System_printf("Core %d : %s free of %s %d - %d : ", coreNum,
+                                                        rmInstName,
+                                                        resourceNameAifRxCh,
+                                                        requestInfo.resourceBase, 
+                                                        (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }      
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
+                 34, 3, 0, NULL, RM_TEST_TRUE, &responseInfo);      
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s free of %s %d - %d : ", coreNum,
+                                                        rmInstName,
+                                                        resourceNameAifRxCh,
+                                                        requestInfo.resourceBase, 
+                                                        (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }      
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
+                 28, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);      
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);   
+    System_printf("Core %d : %s free of %s %d - %d : ", coreNum,
+                                                        rmInstName,
+                                                        resourceNameAifRxCh,
+                                                        requestInfo.resourceBase, 
+                                                        (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }      
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
+                 53, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);      
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);  
+    System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
+                                                                  rmInstName,
+                                                                  resourceNameAifRxCh,
+                                                                  requestInfo.resourceBase, 
+                                                                  (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }  
+    /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */  
+    
+    /* Test exclusive rights to an allocated resource */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
+                 2, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);      
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
+                                                                  rmInstName,
+                                                                  resourceNameAifRxCh,
+                                                                  requestInfo.resourceBase, 
+                                                                  (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState != RM_SERVICE_APPROVED) {
+        System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
+    }
+    else {
+        System_printf("FAILED : expected denial or error\n");
+    }      
+
+    /* Wait for Client and Client Delegate to do their UNSPECIFIED allocates */
+    gateKey = GateMP_enter(gateHandle);
+    GateMP_leave(gateHandle, gateKey);
+
+    /* Test allocation of a resource twice from the same instance with init and use privileges.  Both
+     * should be approved but the instance should only be mentioned once in the resource's owner list */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
+                 6543, 10, 0, NULL, RM_TEST_TRUE, &responseInfo);      
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);  
+    System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
+                                                                   rmInstName,
+                                                                   resourceNameGpQ,
+                                                                   requestInfo.resourceBase, 
+                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }     
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
+                 6543, 10, 0, NULL, RM_TEST_TRUE, &responseInfo);      
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
+                                                                  rmInstName,
+                                                                  resourceNameGpQ,
+                                                                  requestInfo.resourceBase, 
+                                                                  (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }        
+
+    /* Allocate infrastructure queue taken by Linux kernel and shared with Rm_Client.  Expect error or denial. */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ, 
+                 805, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
+                                                                   rmInstName,
+                                                                   resourceNameInfraQ,
+                                                                   requestInfo.resourceBase, 
+                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState != RM_SERVICE_APPROVED) {        
+        System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
+    }
+    else {
+        System_printf("FAILED : expected denial or error\n");
+    }              
+#endif
+
+    System_printf("Core %d: Testing is complete\n", coreNum);
+
+    Rm_instanceStatus(rmHandle);
+    Rm_resourceStatus(rmHandle, RM_TEST_TRUE);   
+
+    Rm_serviceCloseHandle(serviceHandle);
+    
+    /* 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 rmClientTsk(UArg arg0, UArg arg1)
+{
+    Rm_ServiceHandle   *serviceHandle;
+    Rm_ServiceReqInfo   requestInfo;
+    Rm_ServiceRespInfo  responseInfo;    
+    int32_t             rmResult;    
+    Task_Params         taskParams;
+
+    /* Open Client service handle */
+    serviceHandle = Rm_serviceOpenHandle(rmHandle, &rmResult);
+    ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle open failed");
+
+    Rm_instanceStatus(rmHandle);
+
+#if 0
+    /* Retrieve a resource via a NameServer name */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_GET_BY_NAME, NULL, 
+                 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s get resource with name %s : ", coreNum,
+                                                               rmInstName,
+                                                               nameServerNameFavQ);
+    if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
+        waitForResponse(&responseInfo);
+    }
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    } 
+
+    /* Allocate the resource returned from the NameServer request */
+    memset((void *)&requestInfo, 0, sizeof(requestInfo)); 
+    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;     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
+                                                                   rmInstName,
+                                                                   responseInfo.resourceName,
+                                                                   requestInfo.resourceBase, 
+                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
+        waitForResponse(&responseInfo);
+    }
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }    
+
+    /* Free resource via a NameServer name */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, NULL, 
+                 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s free resource with name %s : ", coreNum,
+                                                                rmInstName,
+                                                                nameServerNameFavQ);
+    if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
+        waitForResponse(&responseInfo);
+    }
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }      
+
+    /* Delete the NameServer name */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_UNMAP_NAME, NULL, 
+                 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);     
+    System_printf("Core %d : %s delete name %s : ", coreNum,
+                                                    rmInstName,
+                                                    nameServerNameFavQ);
+    if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
+        waitForResponse(&responseInfo);
+    }
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }     
+
+    GateMP_leave(gateHandle, gateKey);
+    gateKey = GateMP_enter(gateHandle);
+
+    /* 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);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
+                                                                  rmInstName,
+                                                                  resourceNameAifRxCh,
+                                                                  requestInfo.resourceBase, 
+                                                                  (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
+        waitForResponse(&responseInfo);
+    }
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }     
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifRxCh, 
+                 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);        
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
+                                                                   rmInstName,
+                                                                   resourceNameAifRxCh,
+                                                                   requestInfo.resourceBase, 
+                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
+        waitForResponse(&responseInfo);
+    }
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }       
+    /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */
+
+    GateMP_leave(gateHandle, gateKey);    
+    gateKey = GateMP_enter(gateHandle);
+
+    /* 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);        
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
+                                                                                                  rmInstName,
+                                                                                                  resourceNameAccumCh,
+                                                                                                  requestInfo.resourceLength, 
+                                                                                                  requestInfo.resourceAlignment);
+    if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
+        waitForResponse(&responseInfo);
+    }
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }        
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 2, 1, NULL, RM_TEST_TRUE, &responseInfo);      
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo); 
+    System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
+                                                                                                  rmInstName,
+                                                                                                  resourceNameAccumCh,
+                                                                                                  requestInfo.resourceLength, 
+                                                                                                  requestInfo.resourceAlignment);
+    if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
+        waitForResponse(&responseInfo);
+    }
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }     
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
+                 RM_RESOURCE_BASE_UNSPECIFIED, 2, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length UNSPECIFIED alignment : ", coreNum,
+                                                                                                           rmInstName,
+                                                                                                           resourceNameAccumCh,
+                                                                                                           requestInfo.resourceLength);
+    if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
+        waitForResponse(&responseInfo);
+    }
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }     
+    /* 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);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
+                                                                   rmInstName,
+                                                                   resourceNameInfraQ,
+                                                                   requestInfo.resourceBase, 
+                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
+        waitForResponse(&responseInfo);
+    }
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }     
+
+    /* 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, FALSE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);   
+    System_printf("Core %d : %s init allocation (without callback specified) of %s %d - %d : ", coreNum,
+                                                                                                rmInstName,
+                                                                                                resourceNameGpQ,
+                                                                                                requestInfo.resourceBase, 
+                                                                                                (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }   
+
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
+                 7005, 25, 0, NULL, FALSE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);   
+    System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
+                                                                                               rmInstName,
+                                                                                               resourceNameGpQ,
+                                                                                               requestInfo.resourceBase, 
+                                                                                               (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }
+    
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
+                 7010, 5, 0, NULL, FALSE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);   
+    System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
+                                                                                               rmInstName,
+                                                                                               resourceNameGpQ,
+                                                                                               requestInfo.resourceBase, 
+                                                                                               (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }
+
+    /* Init allocation of resource already owned by Client should return approved and the resource should
+     * only be shown as allocated once to the instance in the resource print out */
+    setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
+                 7011, 1, 0, NULL, FALSE, &responseInfo);     
+    serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);   
+    System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
+                                                                                               rmInstName,
+                                                                                               resourceNameGpQ,
+                                                                                               requestInfo.resourceBase, 
+                                                                                               (requestInfo.resourceBase + requestInfo.resourceLength - 1));
+    if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
+        System_printf("PASSED\n");
+    }
+    else {
+        System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
+    }
+    /* END Allocating some resources without providing a callback function.  RM should block and not return until the result
+     * is returned by the server. */    
+#endif
+
+    GateMP_leave(gateHandle, gateKey);           
+
+    System_printf("Core %d: Testing is complete\n", coreNum);
+
+    Rm_serviceCloseHandle(serviceHandle);
+    
+    Rm_instanceStatus(rmHandle);
+    
+    /* 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)
+{
+    Int           status;
+    GateMP_Params gateParams;    
+    Task_Params   taskParams;
+
+    if (coreNum == SYSINIT) {
+        GateMP_Params_init(&gateParams);
+        gateParams.name = RM_TASK_GATE_NAME;
+        gateHandle = GateMP_create(&gateParams);
+    }
+    else {
+        do {
+            status = GateMP_open(RM_TASK_GATE_NAME, &gateHandle);
+            /* 
+             *  Sleep for 1 clock tick to avoid inundating remote processor
+             *  with interrupts if open failed
+             */
+            if (status < 0) { 
+                Task_sleep(1);
+            }
+        } while (status < 0);
+        /* Take the gate right away to prepare for RM testing */
+        gateKey = GateMP_enter(gateHandle);
+    }
+    
+    /* Create the RM test tasks. */
+    if (coreNum == SYSINIT) {
+        System_printf("Core %d: Creating RM server task...\n", coreNum);
+        Task_Params_init (&taskParams);
+        taskParams.priority = 1;
+        rmServerTskHandle = Task_create (rmServerTsk, &taskParams, NULL);
+    }
+    else if (coreNum) {
+        System_printf("Core %d: Creating RM client task...\n", coreNum);
+        Task_Params_init (&taskParams);
+        taskParams.priority = 1;
+        rmClientTskHandle = Task_create (rmClientTsk, &taskParams, NULL);
+    }
+}
+
+void main(Int argc, Char* argv[])
+{
+    Rm_InitCfg          rmInitCfg;
+    Rm_ServiceHandle   *serviceHandle;
+    Rm_ServiceReqInfo   request;
+    Rm_ServiceRespInfo  response;
+    int32_t             rmResult;
+    int                 status;
+
+    System_printf ("*********************************************************\n");
+    System_printf ("******************** RM Memory Test *********************\n");
+    System_printf ("*********************************************************\n");
+
+    System_printf ("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr());
+
+    /* Reset the variable to indicate to other cores RM init is not yet done */
+    isRmInitialized[0] = 0;
+
+    coreNum = CSL_chipReadReg(CSL_CHIP_DNUM);
+
+    System_printf("Core %d: Starting IPC...\n", coreNum);
+    status = Ipc_start();
+    if (status < 0) {
+        System_abort("Ipc_start failed\n");
+    }
+
+    if (coreNum == SYSINIT) {
+        MEM_PRE_PRINT("------------------ Server Inst Init/Del -----------------", "Pre Rm_Init (Server) ");
+        memset((void *)&rmInitCfg, 0, sizeof(rmInitCfg));
+        System_sprintf (rmInstName, "RM_Server");
+        rmInitCfg.instName = rmInstName;
+        rmInitCfg.instType = Rm_instType_SERVER;
+        rmInitCfg.instCfg.serverCfg.globalResourceList = (void *)rmGlobalResourceList;
+        rmInitCfg.instCfg.serverCfg.globalPolicy = (void *)rmDspPlusArmPolicy;
+        rmHandle = Rm_init(&rmInitCfg, &rmResult);
+        ERROR_CHECK(RM_OK, rmResult, rmInstName, "Initialization failed");
+        MEM_MID_PRINT("Post Rm_Init (Server)");      
+        rmResult = Rm_delete(rmHandle, RM_TEST_TRUE);
+        ERROR_CHECK(RM_OK, rmResult, rmInstName, "Delete failed");
+        MEM_END_PRINT("Post Rm_Delete       ");     
+
+        /* Signal to remote cores that Server instance has passed all initialization
+         * memory tests and is ready */
+        isRmInitialized[0] = 1;
+        Osal_rmEndMemAccess((void *)isRmInitialized,sizeof(isRmInitialized));
+    }
+    else {
+        MEM_PRE_PRINT("-------- Client Inst Init/Del (No Static Policy) --------", "Pre Rm_Init (Client) ");        
+        memset((void *)&rmInitCfg, 0, sizeof(rmInitCfg));
+        System_sprintf (rmInstName, "RM_Client%d", coreNum);
+        rmInitCfg.instName = rmInstName;
+        rmInitCfg.instType = Rm_instType_CLIENT;
+        rmHandle = Rm_init(&rmInitCfg, &rmResult);
+        ERROR_CHECK(RM_OK, rmResult, rmInstName, "Initialization failed");
+        MEM_MID_PRINT("Post Rm_Init (Client)"); 
+        rmResult = Rm_delete(rmHandle, RM_TEST_TRUE);
+        ERROR_CHECK(RM_OK, rmResult, rmInstName, "Delete failed");
+        MEM_END_PRINT("Post Rm_Delete       ");
+
+        MEM_PRE_PRINT("--------- Client Inst Init/Del (Static Policy) ----------", "Pre Rm_Init (Client) ");        
+        memset((void *)&rmInitCfg, 0, sizeof(rmInitCfg));
+        System_sprintf (rmInstName, "RM_Client%d", coreNum);
+        rmInitCfg.instName = rmInstName;
+        rmInitCfg.instType = Rm_instType_CLIENT;
+        rmInitCfg.instCfg.clientCfg.staticPolicy = (void *)rmDspPlusArmPolicy;
+        rmHandle = Rm_init(&rmInitCfg, &rmResult);
+        ERROR_CHECK(RM_OK, rmResult, rmInstName, "Initialization failed");
+        MEM_MID_PRINT("Post Rm_Init (Client)"); 
+        rmResult = Rm_delete(rmHandle, RM_TEST_TRUE);
+        ERROR_CHECK(RM_OK, rmResult, rmInstName, "Delete failed");
+        MEM_END_PRINT("Post Rm_Delete       ");
+
+        
+        /* Open CD service handle */
+   //     serviceHandle = Rm_serviceOpenHandle(rmHandle, &rmResult);
+  //      ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle open failed");
+
+        /* Static allocation tests */
+   //     setRmRequest(&request, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
+   //                  0, 1, 0, NULL, RM_TEST_TRUE, &response);
+  //      serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+
+        do{
+            Osal_rmBeginMemAccess((void *)isRmInitialized, sizeof(isRmInitialized));
+        } while (isRmInitialized[0] == 0);             
+    }
+
+    if (setupRmTransConfig(NUM_CORES, SYSINIT, rmStartupTsk) < 0)
+    {
+        System_printf ("Error core %d : Transport setup for RM error\n", coreNum);
+        return;
+    }
+
+    System_printf("Core %d: Starting BIOS...\n", coreNum);
+    BIOS_start();
+
+    return;    
+}
+
index 146551fa880da94616bd0935558456ddc2395029..0071bfad00ac5ad76a580ee9c104bbeb706fa153 100644 (file)
@@ -91,6 +91,8 @@ uint32_t            testCores = 0;
 uint32_t            initCore = 0;
 /* Application test task pointer */
 Task_FuncPtr        appTestTask = NULL;
+/* Receive task handle */
+Task_Handle         rcvTask = NULL;
 
 /* Handle for heap that RM packets will be allocated from */
 HeapBufMP_Handle    rmPktHeapHandle = NULL;
@@ -382,7 +384,7 @@ void configRmTransportTsk(UArg arg0, UArg arg1)
     /* Create the RM receive task.  Receive task has priority of 2 so that it pre-empts the appTestTask */
     Task_Params_init (&taskParams);
     taskParams.priority = 2;
-    Task_create (rmReceiveTsk, &taskParams, NULL);   
+    rcvTask = Task_create (rmReceiveTsk, &taskParams, NULL);   
 
     /* Create the application test task */
     Task_Params_init (&taskParams);
@@ -414,3 +416,36 @@ int setupRmTransConfig(uint32_t numTestCores, uint32_t systemInitCore, Task_Func
     return(0);
 }
 
+int deleteRmTrans(void)
+{
+    uint32_t corenum = 0;
+    uint32_t i;
+    int32_t  rmResult = RM_OK;
+    
+    /* Get the core number. */
+    corenum = CSL_chipReadReg(CSL_CHIP_DNUM);
+
+    /* Delete the RM receive task */
+    System_printf("Core %d: Deleting RM receive task...\n", corenum);
+    if (rcvTask) {
+        Task_delete(&rcvTask);
+        rcvTask = NULL;
+    }
+
+    /* Cleanup transport objects */
+    for (i = 0; i < testCores; i++) {
+         if ((corenum == initCore) && (i != initCore)) {
+             if (rmResult = Rm_transportUnregister(rmTransportMap[i].transportHandle) < 0) {
+                break;
+             }
+         }
+         else if ((corenum != initCore) && (i == initCore)) {
+             if (rmResult = Rm_transportUnregister(rmTransportMap[i].transportHandle) < 0) {
+                break;
+             }
+         }
+    }
+
+    return (rmResult);
+}
+