]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/commitdiff
Added support for Shared Clients which piggyback onto a Shared Server instance in...
authorJustin Sobota <jsobota@ti.com>
Mon, 18 Mar 2013 22:34:38 +0000 (18:34 -0400)
committerJustin Sobota <jsobota@ti.com>
Mon, 18 Mar 2013 22:34:38 +0000 (18:34 -0400)
include/rm_internal.h
include/rm_loc.h
rm.h
src/rm.c
src/rm_services.c
src/rm_transport.c
test/rm_osal.c
test/rm_shared_test.c
test/rm_test.c

index 5923cabaf69688d46bbf741b4d61d006de2dfccf..f9af2bdf56a8654b4c4c19cd912dd1ea5835e212 100644 (file)
@@ -55,10 +55,18 @@ extern "C" {
 #define RM_TRUE  1
 
 /* Shared server enter critical section macro */
-#define RM_SS_INST_INV_ENTER_CS(csKey)                      \
-    Rm_osalBeginMemAccess((void *)rmInst, sizeof(Rm_Inst)); \
-    if (rmInst->instType == Rm_instType_SHARED_SERVER) {    \
-        csKey = Rm_osalCsEnter();                           \
+#define RM_SS_INST_INV_ENTER_CS(csKey)                          \
+    if (rmInst->instType == Rm_instType_SHARED_SERVER) {        \
+        csKey = Rm_osalCsEnter();                               \
+        Rm_osalBeginMemAccess((void *)rmInst, sizeof(Rm_Inst)); \
+    }
+
+/* Shared client enter critical section macro */
+#define RM_SC_INST_INV_ENTER_CS(csKey)                                           \
+    if (rmInst->instType == Rm_instType_SHARED_CLIENT) {                         \
+        csKey = Rm_osalCsEnter();                                                \
+        Rm_osalBeginMemAccess((void *)rmInst->u.sharedClient.sharedServerHandle, \
+                              sizeof(Rm_Inst));                                  \
     }
 
 /* Shared server exit critical section macro */
index 18b3fd26013330c5967f62b02776d99f8f057fc8..5382d6d8cfa6ca4f80ced74df76e17750193221b 100644 (file)
@@ -116,6 +116,12 @@ typedef struct {
     Rm_PolicyValidInstTree *staticValidInstTree;
 } Rm_ClientInstData;
 
+/* Shared Client-specific instance data */
+typedef struct {
+    /* Shared Server instance handle */
+    Rm_Handle sharedServerHandle;
+} Rm_SharedClientInstData;
+
 /* RM instance structure */
 typedef struct {
     /* Name given to the RM instance.  Policy will assign resources based
@@ -148,7 +154,9 @@ typedef struct {
         /* Client Delegate-specific instance data */
         Rm_ClientDelegateInstData cd;
         /* Client-specific instance data */
-        Rm_ClientInstData         client;        
+        Rm_ClientInstData         client;
+        /* Shared Client-specific instance data */
+        Rm_SharedClientInstData   sharedClient;
     } u;
 } Rm_Inst;
 
diff --git a/rm.h b/rm.h
index 1fe43462859a01a4dd7ac26cf392c2e0f143902e..03bd89de5e7d8a3888026227ddb8dbf15ecd6485 100644 (file)
--- a/rm.h
+++ b/rm.h
@@ -317,11 +317,15 @@ extern "C" {
 /** Only the Server instance can be used to return resource status via the
  *  Rm_resourceStatus API */
 #define RM_ERROR_INVALID_RES_STATUS_INSTANCE       RM_ERROR_BASE-45
-/** RM Shared Server instances should always return a finished request since the instance has
- *  access to the resource structures no matter what core the service is requested from */
-#define RM_ERROR_SHARED_SERVER_UNFINISHED_REQ      RM_ERROR_BASE-46
-/** RM Shared Server instances cannot register transports */
-#define RM_ERROR_SHARED_SERVER_CANNOT_REG_TRANS    RM_ERROR_BASE-47
+/** RM Shared Server and Client instances should always return a finished request since 
+ *  the instance has access to the resource structures no matter what core the service
+ *  is requested from */
+#define RM_ERROR_SHARED_INSTANCE_UNFINISHED_REQ    RM_ERROR_BASE-46
+/** RM Shared Server and Client instances cannot register transports */
+#define RM_ERROR_SHARED_INSTANCE_CANNOT_REG_TRANS  RM_ERROR_BASE-47
+/** RM Shared Client handle was provided an invalid Shared Server handle.  The shared
+ *  server handle was either NULL or was not an instance of type Rm_instType_SHARED_SERVER */
+#define RM_ERROR_INVALID_SHARED_SERVER_HANDLE      RM_ERROR_BASE-48
 
 /** 
  * @brief Maximum number of characters allowed for RM instance, resource, and
@@ -351,6 +355,10 @@ typedef enum {
      *  and register transports.  Allows requests to be fulfilled from any DSP
      *  core without blocking */
     Rm_instType_SHARED_SERVER,
+    /** RM Shared Client - Piggybacks on the Shared Server instance to handle
+     *  service requests from resource and policy data structures in shared
+     *  memory */
+    Rm_instType_SHARED_CLIENT,
     /** DO NOT USE: Last type */
     Rm_instType_LAST
 } Rm_InstType;
@@ -400,6 +408,18 @@ typedef struct {
     void *staticPolicy;
 } Rm_ClientCfg;
 
+/**
+ * @brief RM shared client initialization configurations
+ */
+typedef struct {
+    /** RM Shared Server handle.  Typically, the Shared Server handle is created on
+     *  DSP core designated for system initialization.  The application then
+     *  the Shared Server handle, located in shared memory, to the other DSP cores.
+     *  These DSP cores can then piggyback onto the shared memory data structures in
+     *  the Shared Server via the Shared Client */
+     Rm_Handle sharedServerHandle;
+} Rm_SharedClientCfg;
+
 /** 
  * @brief RM instance initialization structure
  */
@@ -420,6 +440,8 @@ typedef struct {
         Rm_ClientDelegateCfg cdCfg;
         /** #Rm_ClientCfg */
         Rm_ClientCfg         clientCfg;
+        /** #Rm_SharedClientCfg */
+        Rm_SharedClientCfg   sharedClientCfg;
     } instCfg;
 } Rm_InitCfg;
 
index a46aa058f2512749deea3e024bb8f1a978735dd8..5834ed58c471779cfeeb7b1dd16e24cd53b6e38c 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -714,9 +714,12 @@ static void serverProcess (Rm_Inst *rmInst, Rm_Transaction *transaction)
             break;
     }
 
-    if (strncmp(transaction->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS)) {
-        /* Source of transaction was not Server, return transaction via responder */
-        transactionResponder(rmInst, transaction);
+    /* Source of shared server transaction will always be local. */
+    if (rmInst->instType != Rm_instType_SHARED_SERVER) {
+        if (strncmp(transaction->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS)) {
+            /* Source of transaction was not Server, return transaction via responder */
+            transactionResponder(rmInst, transaction);
+        }
     }
     /* Otherwise let call stack return transaction result app via Rm_serviceHandler */ 
 }
@@ -857,6 +860,12 @@ int32_t Rm_resourceStatus(Rm_Handle rmServerHandle, int printResources)
     void            *key; 
 
     RM_SS_INST_INV_ENTER_CS(key);
+    RM_SC_INST_INV_ENTER_CS(key);
+
+    if (rmInst->instType == Rm_instType_SHARED_CLIENT) {
+        /* Transfer control to shared server instance */
+        rmInst = rmInst->u.sharedClient.sharedServerHandle;
+    }
 
     if ((rmInst->instType == Rm_instType_SERVER) ||
         (rmInst->instType == Rm_instType_SHARED_SERVER)) {
@@ -933,6 +942,7 @@ void Rm_instanceStatus(Rm_Handle rmHandle)
     void           *key; 
 
     RM_SS_INST_INV_ENTER_CS(key);
+    RM_SC_INST_INV_ENTER_CS(key);
 
     Rm_osalLog("Instance name: %s\n", rmInst->instName);
     Rm_osalLog("Handle: 0x%08x\n", rmHandle);    
@@ -948,6 +958,16 @@ void Rm_instanceStatus(Rm_Handle rmHandle)
     else if (rmInst->instType == Rm_instType_SHARED_SERVER) {
         Rm_osalLog("Type:   Shared Server\n");
     }
+    else if (rmInst->instType == Rm_instType_SHARED_CLIENT) {
+        Rm_osalLog("Type:   Shared Client\n");
+
+        Rm_osalLog("\nShared Server Properties:\n");
+        /* Transfer to Shared Server instance to print out transport and
+         * transaction status */
+        rmInst = rmInst->u.sharedClient.sharedServerHandle;
+        Rm_osalLog("Instance name: %s\n", rmInst->instName);
+        Rm_osalLog("Handle: 0x%08x\n", rmHandle);
+    }
     
     transportList = rmInst->transports;
     if (transportList) {
@@ -1000,9 +1020,11 @@ void Rm_instanceStatus(Rm_Handle rmHandle)
 Rm_Handle Rm_init(const Rm_InitCfg *initCfg, int32_t *result)
 {
     Rm_Inst *rmInst = NULL;
+    Rm_Inst *sharedServerInst = NULL;
     void    *globalResourceDtb = NULL;
     void    *linuxResourceDtb = NULL;
     int      addLinux = RM_FALSE;   
+    void    *key;     
 
     *result = RM_OK;
     
@@ -1103,12 +1125,32 @@ Rm_Handle Rm_init(const Rm_InitCfg *initCfg, int32_t *result)
             }
         }
     }
+    else if (rmInst->instType == Rm_instType_SHARED_CLIENT) {
+        if (initCfg->instCfg.sharedClientCfg.sharedServerHandle) {
+            rmInst->u.sharedClient.sharedServerHandle = initCfg->instCfg.sharedClientCfg.sharedServerHandle;
+            /* Invalidate the Shared server instance structure on this core to get the latest
+             * instance data. */
+            key = Rm_osalCsEnter();
+            Rm_osalBeginMemAccess((void *)rmInst->u.sharedClient.sharedServerHandle, sizeof(Rm_Inst));
+            sharedServerInst = rmInst->u.sharedClient.sharedServerHandle;
+            if (sharedServerInst->instType != Rm_instType_SHARED_SERVER) {
+                *result = RM_ERROR_INVALID_SHARED_SERVER_HANDLE;
+                Rm_osalCsExit(key);
+                goto errorExit;
+            }
+            Rm_osalCsExit(key);
+        }
+        else {
+            *result = RM_ERROR_INVALID_SHARED_SERVER_HANDLE;
+            goto errorExit;
+        }
+    }
 
     if (initCfg->instType == Rm_instType_SHARED_SERVER) {
-        /* Invalidate the instance for other cores */
+        /* Writeback the instance for other cores */
         Rm_osalEndMemAccess ((void *)rmInst, sizeof(Rm_Inst));
     }
-    else {
+    else if (rmInst->instType != Rm_instType_SHARED_CLIENT) {
         /* Create the instance's task blocking mechanism */
         rmInst->blockHandle = Rm_osalTaskBlockCreate();
     }
@@ -1132,7 +1174,10 @@ int32_t Rm_delete(Rm_Handle rmHandle, int ignorePendingServices)
     Rm_Inst *rmInst = (Rm_Inst *)rmHandle;
     void    *key; 
 
-    RM_SS_INST_INV_ENTER_CS(key);
+    key = Rm_osalCsEnter();
+    if (rmInst->instType == Rm_instType_SHARED_SERVER) {
+        Rm_osalBeginMemAccess((void *)rmInst, sizeof(Rm_Inst));
+    }
 
     if (rmInst->serviceHandle) {
         return (RM_ERROR_CANT_DELETE_WITH_OPEN_SERV_HNDL);
@@ -1150,26 +1195,27 @@ int32_t Rm_delete(Rm_Handle rmHandle, int ignorePendingServices)
         rmNameServerDelete(rmHandle);
     }
 
-    /* Delete valid instance tree */
-    rmPolicyFreeValidInstTree(rmHandle);
+    if (rmInst->instType != Rm_instType_SHARED_CLIENT) {
+        /* Delete valid instance tree */
+        rmPolicyFreeValidInstTree(rmHandle);
 
-    /* Delete any transactions */
-    while(rmInst->transactionQueue) {
-        rmTransactionQueueDelete(rmInst, rmInst->transactionQueue->localId);
-    }
+        /* Delete any transactions */
+        while(rmInst->transactionQueue) {
+            rmTransactionQueueDelete(rmInst, rmInst->transactionQueue->localId);
+        }
 
-    if (rmInst->instType != Rm_instType_SHARED_SERVER) {
-        /* Delete the instance's task blocking mechanism */
-        Rm_osalTaskBlockDelete(rmInst->blockHandle);
-    }
-    else {
-        Rm_osalEndMemAccess((void *)rmInst, sizeof(Rm_Inst));
+        if (rmInst->instType != Rm_instType_SHARED_SERVER) {
+            /* Delete the instance's task blocking mechanism */
+            Rm_osalTaskBlockDelete(rmInst->blockHandle);
+        }
+        else {
+            Rm_osalEndMemAccess((void *)rmInst, sizeof(Rm_Inst));
+        }
     }
 
     Rm_osalFree((void *)rmInst, sizeof(Rm_Inst));
-    if (rmInst->instType == Rm_instType_SHARED_SERVER) {    
-        Rm_osalCsExit(key);   
-    }
+   
+    Rm_osalCsExit(key);   
     return (RM_OK);
 }
 
index aa6b61331c71ecb9fc90392196c641dab7725930..a2f691d328db7dc7e16db9eaf1bcf97e2d15c10b 100644 (file)
@@ -93,10 +93,12 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
                         Rm_ServiceRespInfo *serviceResponse)
 {
     Rm_Inst        *rmInst = (Rm_Inst *)rmHandle;
+    char           *instanceName;
     Rm_Transaction *transaction;
     void           *key;     
 
     RM_SS_INST_INV_ENTER_CS(key);
+    RM_SC_INST_INV_ENTER_CS(key);
 
     if (rmInst->isLocked) {
         serviceResponse->serviceState = RM_SERVICE_DENIED_RM_INSTANCE_LOCKED;
@@ -107,11 +109,19 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
         serviceResponse->serviceState = RM_ERROR_INVALID_SERVICE_TYPE;
         return;
     }
+
+    /* Copy location of instance name to local variable in case Shared Client needs to
+     * transfer control to a shared server */
+    instanceName = rmInst->instName;
+    if (rmInst->instType == Rm_instType_SHARED_CLIENT) {
+        /* Transfer control to shared server instance */
+        rmInst = rmInst->u.sharedClient.sharedServerHandle;
+    }       
     
     transaction = rmTransactionQueueAdd(rmInst);
     if (transaction) {
         transaction->type = serviceRequest->type;
-        strncpy(transaction->serviceSrcInstName, rmInst->instName, RM_NAME_MAX_CHARS);
+        strncpy(transaction->serviceSrcInstName, instanceName, RM_NAME_MAX_CHARS);
         transaction->callback.serviceCallback = serviceRequest->callback.serviceCallback;
         transaction->state = RM_SERVICE_PROCESSING;
         if (serviceRequest->resourceName) {
@@ -132,7 +142,7 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
         if ((rmInst->instType == Rm_instType_SHARED_SERVER) && 
             (transaction->state == RM_SERVICE_PROCESSING)) {
             /* Shared Server should always return a fully processed transaction */
-            serviceResponse->serviceState = RM_ERROR_SHARED_SERVER_UNFINISHED_REQ;
+            serviceResponse->serviceState = RM_ERROR_SHARED_INSTANCE_UNFINISHED_REQ;
             rmTransactionQueueDelete(rmInst, transaction->localId);
         }
         else {
index d2e192283ae967f33ae9a0f7428aeba1dc7a705b..a952fcff6797b00d4f1401fabce07105bcc8515a 100644 (file)
@@ -209,9 +209,10 @@ Rm_TransportHandle Rm_transportRegister (const Rm_TransportCfg *transportCfg, in
 \r
     RM_SS_INST_INV_ENTER_CS(key);\r
 \r
-    /* Shared servers cannot connect to anyone */\r
-    if (rmInst->instType == Rm_instType_SHARED_SERVER) {\r
-        *result = RM_ERROR_SHARED_SERVER_CANNOT_REG_TRANS;\r
+    /* Shared servers and clients cannot connect to anyone */\r
+    if ((rmInst->instType == Rm_instType_SHARED_SERVER) ||\r
+        (rmInst->instType == Rm_instType_SHARED_CLIENT)){\r
+        *result = RM_ERROR_SHARED_INSTANCE_CANNOT_REG_TRANS;\r
         goto errorExit;\r
     }\r
 \r
index 12ccad710b9e8bae7a6e88c48a1c2df1031ba9bc..c8bfc3a64fc1b5de797a18e5a12dc9255e5637db 100644 (file)
@@ -135,27 +135,25 @@ void Osal_rmBeginMemAccess(void *ptr, uint32_t size)
 {
     uint32_t    key;
 
-    /* TEMP: only do invalidate for MSMC */
-    if (((uint32_t)ptr) & 0x0C000000) {
-        /* Disable Interrupts */
-        key = Hwi_disable();
+    /* Disable Interrupts */
+    key = Hwi_disable();
 
-        /* Cleanup the prefetch buffer also. */
-        CSL_XMC_invalidatePrefetchBuffer();
+    /* Cleanup the prefetch buffer also. */
+    CSL_XMC_invalidatePrefetchBuffer();
 
 #ifdef L2_CACHE
-        /* Invalidate L2 cache. This should invalidate L1D as well. 
-         * Wait until operation is complete. */    
-        CACHE_invL2 (ptr, size, CACHE_FENCE_WAIT);
+    /* Invalidate L2 cache. This should invalidate L1D as well. 
+     * Wait until operation is complete. */    
+    CACHE_invL2 (ptr, size, CACHE_FENCE_WAIT);
 #else       
-        /* Invalidate L1D cache and wait until operation is complete. 
-         * Use this approach if L2 cache is not enabled */    
-        CACHE_invL1d (ptr, size, CACHE_FENCE_WAIT);
+    /* Invalidate L1D cache and wait until operation is complete. 
+     * Use this approach if L2 cache is not enabled */    
+    CACHE_invL1d (ptr, size, CACHE_FENCE_WAIT);
 #endif
 
-        /* Reenable Interrupts. */
-        Hwi_restore(key);
-    }
+    /* Reenable Interrupts. */
+    Hwi_restore(key);
+
     return;
 }
 
@@ -170,25 +168,23 @@ void Osal_rmEndMemAccess(void *ptr, uint32_t size)
 {
     uint32_t    key;
 
-    /* TEMP: only do writeback for MSMC */
-    if (((uint32_t)ptr) & 0x0C000000) {
-        /* Disable Interrupts */
-        key = Hwi_disable();
+    /* Disable Interrupts */
+    key = Hwi_disable();
 
 #ifdef L2_CACHE
-        /* Writeback L2 cache. This should Writeback L1D as well. 
-         * Wait until operation is complete. */ 
-        CACHE_wbL2 (ptr, size, CACHE_FENCE_WAIT);
+    /* Writeback L2 cache. This should Writeback L1D as well. 
+     * Wait until operation is complete. */ 
+    CACHE_wbL2 (ptr, size, CACHE_FENCE_WAIT);
 
 #else    
-        /* Writeback L1D cache and wait until operation is complete. 
-         * Use this approach if L2 cache is not enabled */    
-        CACHE_wbL1d (ptr, size, CACHE_FENCE_WAIT);
+    /* Writeback L1D cache and wait until operation is complete. 
+     * Use this approach if L2 cache is not enabled */    
+    CACHE_wbL1d (ptr, size, CACHE_FENCE_WAIT);
 #endif
 
-        /* Reenable Interrupts. */
-        Hwi_restore(key);
-    }
+    /* Reenable Interrupts. */
+    Hwi_restore(key);
+
     return;
 }
 
index aeb28242cc79b2047f0f3d0d75894faa9a78c93e..ba0c861c63d0f43486e699defcbca18df8cf2140 100644 (file)
@@ -135,16 +135,27 @@ GateMP_Handle       gateHandle = NULL;
 /* GateMP key */
 IArg                gateKey;
 
-/* RM Server instance name (must match with RM Global Resource List (GRL) and policies */
-char                rmServerName[RM_NAME_MAX_CHARS] = "RM_Server";
+/* RM Shared Server instance name (must match with RM Global Resource List (GRL) and policies */
+char                rmServerName[RM_NAME_MAX_CHARS]        = "RM_Server";
+/* First Shared Client instance name (must match with RM Global Resource List (GRL) and policies */
+char                rmSharedClient1Name[RM_NAME_MAX_CHARS] = "RM_Client_Delegate";
+/* Second Shared Client instance name (must match with RM Global Resource List (GRL) and policies */
+char                rmSharedClient2Name[RM_NAME_MAX_CHARS] = "RM_Client";
 
 /* RM shared server instance handle */
 #pragma DATA_SECTION (rmSharedHandle, ".rmTestSharedHandle");
 #pragma DATA_ALIGN (rmSharedHandle, RM_TEST_MAX_CACHE_ALIGN)
 Test_SharedRmHandle rmSharedHandle = {NULL};
 
+/* First Shared Client instance (local memory) */
+Rm_Handle rmSharedClient1Handle = NULL;
+/* Second Shared Client instance (local memory) */
+Rm_Handle rmSharedClient2Handle = NULL;
+
 /* RM shared server instance service handle */
-Rm_ServiceHandle   *rmSharedServiceHandle = NULL;
+Rm_ServiceHandle   *rmSharedServiceHandle        = NULL;
+Rm_ServiceHandle   *rmSharedClient1ServiceHandle = NULL;
+Rm_ServiceHandle   *rmSharedClient2ServiceHandle = NULL;
 
 /* RM resource names (must match resource node names in GRL and policies */
 char                resourceNameMemRegion[RM_NAME_MAX_CHARS]  = "memory-regions";
@@ -404,7 +415,23 @@ void rmServerTsk(UArg arg0, UArg arg1)
     else {
         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
     }  
-    /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */       
+    /* 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);      
+    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
+                                                                  rmServerName,
+                                                                  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);
@@ -475,14 +502,15 @@ void rmClientTsk(UArg arg0, UArg arg1)
     Rm_ServiceRespInfo responseInfo;    
     Task_Params        taskParams;
 
-    Rm_instanceStatus(rmSharedHandle.sharedServerHandle);
+    Rm_instanceStatus(rmSharedClient1Handle);
+    Rm_instanceStatus(rmSharedClient2Handle);
 
     /* Retrieve a resource via a NameServer name */
     setRmRequest(&requestInfo, Rm_service_RESOURCE_GET_BY_NAME, NULL, 
                  0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    rmSharedClient1ServiceHandle->Rm_serviceHandler(rmSharedClient1ServiceHandle->rmHandle, &requestInfo, &responseInfo);
     System_printf("Core %d : %s get resource with name %s : ", coreNum,
-                                                               rmServerName,
+                                                               rmSharedClient1Name,
                                                                nameServerNameFavQ);
     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
         System_printf("PASSED\n");
@@ -497,10 +525,10 @@ void rmClientTsk(UArg arg0, UArg arg1)
     requestInfo.resourceName = responseInfo.resourceName;
     requestInfo.resourceBase = responseInfo.resourceBase;
     requestInfo.resourceLength = responseInfo.resourceLength;
-    requestInfo.resourceNsName = NULL;   
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    requestInfo.resourceNsName = NULL;
+    rmSharedClient2ServiceHandle->Rm_serviceHandler(rmSharedClient2ServiceHandle->rmHandle, &requestInfo, &responseInfo);
     System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
-                                                                   rmServerName,
+                                                                   rmSharedClient2Name,
                                                                    responseInfo.resourceName,
                                                                    requestInfo.resourceBase, 
                                                                    (requestInfo.resourceBase + requestInfo.resourceLength - 1));
@@ -514,9 +542,9 @@ void rmClientTsk(UArg arg0, UArg arg1)
     /* Free resource via a NameServer name */
     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, NULL, 
                  0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    rmSharedClient2ServiceHandle->Rm_serviceHandler(rmSharedClient2ServiceHandle->rmHandle, &requestInfo, &responseInfo);
     System_printf("Core %d : %s free resource with name %s : ", coreNum,
-                                                                rmServerName,
+                                                                rmSharedClient2Name,
                                                                 nameServerNameFavQ);
     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
         System_printf("PASSED\n");
@@ -528,9 +556,9 @@ void rmClientTsk(UArg arg0, UArg arg1)
     /* Delete the NameServer name */
     setRmRequest(&requestInfo, Rm_service_RESOURCE_UNMAP_NAME, NULL, 
                  0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);     
+    rmSharedClient2ServiceHandle->Rm_serviceHandler(rmSharedClient2ServiceHandle->rmHandle, &requestInfo, &responseInfo);     
     System_printf("Core %d : %s delete name %s : ", coreNum,
-                                                    rmServerName,
+                                                    rmSharedClient2Name,
                                                     nameServerNameFavQ);
     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
         System_printf("PASSED\n");
@@ -545,9 +573,9 @@ void rmClientTsk(UArg arg0, UArg arg1)
     /* 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);     
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    rmSharedClient2ServiceHandle->Rm_serviceHandler(rmSharedClient2ServiceHandle->rmHandle, &requestInfo, &responseInfo);
     System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
-                                                                  rmServerName,
+                                                                  rmSharedClient2Name,
                                                                   resourceNameAifRxCh,
                                                                   requestInfo.resourceBase, 
                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
@@ -560,9 +588,9 @@ void rmClientTsk(UArg arg0, UArg arg1)
     
     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifRxCh, 
                  50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);        
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    rmSharedClient1ServiceHandle->Rm_serviceHandler(rmSharedClient1ServiceHandle->rmHandle, &requestInfo, &responseInfo);
     System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
-                                                                   rmServerName,
+                                                                   rmSharedClient1Name,
                                                                    resourceNameAifRxCh,
                                                                    requestInfo.resourceBase, 
                                                                    (requestInfo.resourceBase + requestInfo.resourceLength - 1));
@@ -580,9 +608,9 @@ void rmClientTsk(UArg arg0, UArg arg1)
     /* 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);        
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    rmSharedClient1ServiceHandle->Rm_serviceHandler(rmSharedClient1ServiceHandle->rmHandle, &requestInfo, &responseInfo);
     System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
-                                                                                                  rmServerName,
+                                                                                                  rmSharedClient1Name,
                                                                                                   resourceNameAccumCh,
                                                                                                   requestInfo.resourceLength, 
                                                                                                   requestInfo.resourceAlignment);
@@ -595,9 +623,9 @@ void rmClientTsk(UArg arg0, UArg arg1)
 
     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
                  RM_RESOURCE_BASE_UNSPECIFIED, 2, 1, NULL, RM_TEST_TRUE, &responseInfo);      
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo); 
+    rmSharedClient2ServiceHandle->Rm_serviceHandler(rmSharedClient2ServiceHandle->rmHandle, &requestInfo, &responseInfo); 
     System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
-                                                                                                  rmServerName,
+                                                                                                  rmSharedClient2Name,
                                                                                                   resourceNameAccumCh,
                                                                                                   requestInfo.resourceLength, 
                                                                                                   requestInfo.resourceAlignment);
@@ -610,9 +638,9 @@ void rmClientTsk(UArg arg0, UArg arg1)
 
     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
                  RM_RESOURCE_BASE_UNSPECIFIED, 2, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);     
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    rmSharedClient2ServiceHandle->Rm_serviceHandler(rmSharedClient2ServiceHandle->rmHandle, &requestInfo, &responseInfo);
     System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length UNSPECIFIED alignment : ", coreNum,
-                                                                                                           rmServerName,
+                                                                                                           rmSharedClient2Name,
                                                                                                            resourceNameAccumCh,
                                                                                                            requestInfo.resourceLength);
     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
@@ -621,15 +649,31 @@ void rmClientTsk(UArg arg0, UArg arg1)
     else {
         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
     }     
-    /* END testing allocations with UNSPECIFIED base and alignment values */       
+    /* 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);     
+    rmSharedClient2ServiceHandle->Rm_serviceHandler(rmSharedClient2ServiceHandle->rmHandle, &requestInfo, &responseInfo);
+    System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
+                                                                   rmSharedClient2Name,
+                                                                   resourceNameInfraQ,
+                                                                   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);
+    }     
 
     /* 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);     
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);   
+    rmSharedClient2ServiceHandle->Rm_serviceHandler(rmSharedClient2ServiceHandle->rmHandle, &requestInfo, &responseInfo);   
     System_printf("Core %d : %s init allocation (without callback specified) of %s %d - %d : ", coreNum,
-                                                                                                rmServerName,
+                                                                                                rmSharedClient2Name,
                                                                                                 resourceNameGpQ,
                                                                                                 requestInfo.resourceBase, 
                                                                                                 (requestInfo.resourceBase + requestInfo.resourceLength - 1));
@@ -642,9 +686,9 @@ void rmClientTsk(UArg arg0, UArg arg1)
 
     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
                  7005, 25, 0, NULL, FALSE, &responseInfo);     
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);   
+    rmSharedClient1ServiceHandle->Rm_serviceHandler(rmSharedClient1ServiceHandle->rmHandle, &requestInfo, &responseInfo);   
     System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
-                                                                                               rmServerName,
+                                                                                               rmSharedClient1Name,
                                                                                                resourceNameGpQ,
                                                                                                requestInfo.resourceBase, 
                                                                                                (requestInfo.resourceBase + requestInfo.resourceLength - 1));
@@ -657,9 +701,9 @@ void rmClientTsk(UArg arg0, UArg arg1)
     
     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
                  7010, 5, 0, NULL, FALSE, &responseInfo);     
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);   
+    rmSharedClient2ServiceHandle->Rm_serviceHandler(rmSharedClient2ServiceHandle->rmHandle, &requestInfo, &responseInfo);   
     System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
-                                                                                               rmServerName,
+                                                                                               rmSharedClient2Name,
                                                                                                resourceNameGpQ,
                                                                                                requestInfo.resourceBase, 
                                                                                                (requestInfo.resourceBase + requestInfo.resourceLength - 1));
@@ -674,9 +718,9 @@ void rmClientTsk(UArg arg0, UArg arg1)
      * 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);     
-    rmSharedServiceHandle->Rm_serviceHandler(rmSharedServiceHandle->rmHandle, &requestInfo, &responseInfo);   
+    rmSharedClient2ServiceHandle->Rm_serviceHandler(rmSharedClient2ServiceHandle->rmHandle, &requestInfo, &responseInfo);   
     System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
-                                                                                               rmServerName,
+                                                                                               rmSharedClient2Name,
                                                                                                resourceNameGpQ,
                                                                                                requestInfo.resourceBase, 
                                                                                                (requestInfo.resourceBase + requestInfo.resourceLength - 1));
@@ -693,7 +737,8 @@ void rmClientTsk(UArg arg0, UArg arg1)
 
     System_printf("Core %d: Testing is complete\n", coreNum);
 
-    Rm_instanceStatus(rmSharedHandle.sharedServerHandle);
+    Rm_instanceStatus(rmSharedClient1Handle);
+    Rm_instanceStatus(rmSharedClient2Handle);
     
     /* Create the RM cleanup task. */
     System_printf("Core %d: Creating RM cleanup task...\n", coreNum);
@@ -789,8 +834,28 @@ int main(Int argc, Char* argv[])
         do {
             Osal_rmBeginMemAccess((void *)&rmSharedHandle, sizeof(Test_SharedRmHandle));
         } while (!rmSharedHandle.sharedServerHandle);
-        rmSharedServiceHandle = Rm_serviceOpenHandle(rmSharedHandle.sharedServerHandle, &result);
-        ERROR_CHECK(RM_OK, result, rmServerName, "Service handle open failed");
+
+        /* Create the first Shared Client instance */
+        rmInitCfg.instName = rmSharedClient1Name;
+        rmInitCfg.instType = Rm_instType_SHARED_CLIENT;
+        rmInitCfg.instCfg.sharedClientCfg.sharedServerHandle = rmSharedHandle.sharedServerHandle;
+        rmSharedClient1Handle = Rm_init(&rmInitCfg, &result);
+        ERROR_CHECK(RM_OK, result, rmSharedClient1Name, "Initialization failed");
+
+        /* Open shared client service handle */
+        rmSharedClient1ServiceHandle = Rm_serviceOpenHandle(rmSharedClient1Handle, &result);
+        ERROR_CHECK(RM_OK, result, rmSharedClient1Name, "Service handle open failed");
+
+        /* Create the second Shared Client instance */
+        rmInitCfg.instName = rmSharedClient2Name;
+        rmInitCfg.instType = Rm_instType_SHARED_CLIENT;
+        rmInitCfg.instCfg.sharedClientCfg.sharedServerHandle = rmSharedHandle.sharedServerHandle;
+        rmSharedClient2Handle = Rm_init(&rmInitCfg, &result);
+        ERROR_CHECK(RM_OK, result, rmSharedClient2Name, "Initialization failed");
+
+        /* Open shared client service handle */
+        rmSharedClient2ServiceHandle = Rm_serviceOpenHandle(rmSharedClient2Handle, &result);
+        ERROR_CHECK(RM_OK, result, rmSharedClient2Name, "Service handle open failed");
     }
 
     /* Create the RM startup task */
index 92414f4cd678163d8d437f1c29c46ead3e981840..ede1061f63cfe3c49671e1c039d14841524fc266 100644 (file)
@@ -546,7 +546,7 @@ void rmServerTsk(UArg arg0, UArg arg1)
         System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
     }
     else {
-        System_printf("FAILED\n");
+        System_printf("FAILED : expected denial or error\n");
     }    
 
     /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
@@ -658,7 +658,7 @@ void rmServerTsk(UArg arg0, UArg arg1)
         System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
     }
     else {
-        System_printf("FAILED\n");
+        System_printf("FAILED : expected denial or error\n");
     }      
 
     /* Wait for Client and Client Delegate to do their UNSPECIFIED allocates */
@@ -710,7 +710,7 @@ void rmServerTsk(UArg arg0, UArg arg1)
         System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
     }
     else {
-        System_printf("FAILED\n");
+        System_printf("FAILED : expected denial or error\n");
     }              
 
     System_printf("Core %d: Testing is complete\n", coreNum);
@@ -1407,7 +1407,7 @@ int main(Int argc, Char* argv[])
             System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
         }
         else {
-            System_printf("FAILED\n");
+            System_printf("FAILED : expected denial or error\n");
         }
 
         /* Request resource from both Client and CD that is shared according to static policy */