Added multi-threaded OSAL for rm instance serialization
authorJustin Sobota <jsobota@ti.com>
Mon, 1 Dec 2014 20:48:30 +0000 (15:48 -0500)
committerJustin Sobota <jsobota@ti.com>
Mon, 1 Dec 2014 20:48:30 +0000 (15:48 -0500)
20 files changed:
docs/ReleaseNotes_RM.doc
docs/ReleaseNotes_RM.pdf
include/rm_internal.h
include/rm_loc.h
rm.h
rm_osal.h
src/rm.c
src/rm_allocator.c
src/rm_nameserver.c
src/rm_services.c
src/rm_transport.c
test/armv7/linux/rm_linux_osal.c
test/armv7/linux/rm_server_osal.c
test/k2e/c66/bios/rm_osal.c
test/k2h/c66/bios/rm_osal.c
test/k2h/c66/bios/rm_shared_osal.c
test/k2k/c66/bios/rm_osal.c
test/k2k/c66/bios/rm_shared_osal.c
test/k2l/c66/bios/rm_osal.c
test/k2l/c66/bios/rm_shared_osal.c

index c4b12f44580f18d17bb52345942e6c408d38560c..90c2a52878a3a416d596917ede35d5f49219613a 100644 (file)
Binary files a/docs/ReleaseNotes_RM.doc and b/docs/ReleaseNotes_RM.doc differ
index c7d725d2cbfc0250fb6304b7823ab1373077d3fd..eda6873042562a9e7acb2919a1b37ff7fa39dcc6 100644 (file)
Binary files a/docs/ReleaseNotes_RM.pdf and b/docs/ReleaseNotes_RM.pdf differ
index ce07e38b70d462f0839ca4c0ec1433c915747d1a..898ca3b817339f9833c6e076c09146645cd15955 100644 (file)
@@ -62,14 +62,14 @@ extern "C" {
 #define RM_MAX_CACHE_ALIGN 128
 
 /* Shared server enter critical section macro */
-#define RM_SS_INST_INV_ENTER_CS(csKey)                          \
+#define RM_SS_INST_INV_ENTER_CS(rmInst, 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)                                           \
+#define RM_SC_INST_INV_ENTER_CS(rmInst, csKey)                                   \
     if (rmInst->instType == Rm_instType_SHARED_CLIENT) {                         \
         csKey = Rm_osalCsEnter();                                                \
         Rm_osalBeginMemAccess((void *)rmInst->u.sharedClient.sharedServerHandle, \
@@ -77,20 +77,20 @@ extern "C" {
     }
 
 /* Shared server exit critical section macro */
-#define RM_SS_INST_WB_EXIT_CS(csKey)                          \
+#define RM_SS_INST_WB_EXIT_CS(rmInst, csKey)                  \
     if (rmInst->instType == Rm_instType_SHARED_SERVER) {      \
         Rm_osalEndMemAccess((void *)rmInst, sizeof(Rm_Inst)); \
         Rm_osalCsExit(csKey);                                 \
     }  
 
 /* Shared server invalidate macro */
-#define RM_SS_OBJ_INV(obj, objType)                          \
+#define RM_SS_OBJ_INV(rmInst, obj, objType)                  \
     if (rmInst->instType == Rm_instType_SHARED_SERVER) {     \
         Rm_osalBeginMemAccess((void *)obj, sizeof(objType)); \
     }
 
 /* Shared server writeback macro */
-#define RM_SS_OBJ_WB(obj, objType)                         \
+#define RM_SS_OBJ_WB(rmInst, obj, objType)                 \
     if (rmInst->instType == Rm_instType_SHARED_SERVER) {   \
         Rm_osalEndMemAccess((void *)obj, sizeof(objType)); \
     }    
index dd6539ff6f938771ad989acc9ba25a64e3ae7964..ce1de29e739e9b10fc21f249b6d2c53e8058cedb 100644 (file)
@@ -156,6 +156,8 @@ typedef struct {
      * a service request that requires a blocking operation to complete and
      * a service callback function has not been provided */
     void             *blockHandle;
+    /* Multi-threaded semaphore object */
+    uint32_t         *mtSemObj;
     /* Instance-type specific constructs */
     union {
         /* Server-specific instance data */
diff --git a/rm.h b/rm.h
index 7ea7f81dedcb6e5c673b2f0ade9bb78a4ac3a03d..0d81d1230754c63915258ecc3bf4308cf099b33a 100644 (file)
--- a/rm.h
+++ b/rm.h
@@ -488,6 +488,16 @@ typedef struct {
     const char  *instName;
     /** The type of RM instance that will be created. */
     Rm_InstType  instType;
+    /** Instance's multi-threaded semaphore object.  Two or more RM instances can have
+     *  their service transactions to the Server serialized by providing a valid
+     *  multi-threaded semaphore object.  The semaphore object will be used by the 
+     *  Osal_rmMtCsEnter and Osal_rmMtCsExit functions.  The multi-threaded
+     *  semaphore associated with the provided object will be taken when a
+     *  service transaction is requested.  The semaphore will be released when
+     *  the service response is returned.  This will serialize the transactions
+     *  of any RM instance initialized with the same multi-threaded sem object.
+     *  Multi-threaded semaphores will not be used if NULL is provided as the object */
+    uint32_t    *mtSemObj;
     /** Instance-type specific configurations */
     union {
         /** #Rm_ServerCfg */
index e9245768b3ba94c812cf0f339b554dd42d28c99d..fbee72006466e9838f67bc0803195bfd94d8746a 100644 (file)
--- a/rm_osal.h
+++ b/rm_osal.h
@@ -79,6 +79,8 @@ extern void *Osal_rmMalloc (uint32_t num_bytes);
 extern void  Osal_rmFree (void *ptr, uint32_t size);
 extern void *Osal_rmCsEnter (void);
 extern void  Osal_rmCsExit (void *CsHandle);
+extern void *Osal_rmMtCsEnter (void *mtSemObj);
+extern void  Osal_rmMtCsExit (void *mtSemObj, void *CsHandle);
 extern void  Osal_rmBeginMemAccess (void *ptr, uint32_t size);
 extern void  Osal_rmEndMemAccess (void *ptr, uint32_t size);
 extern void *Osal_rmTaskBlockCreate (void);
@@ -168,6 +170,49 @@ extern void  Osal_rmLog (char *fmt, ... );
  */
 #define Rm_osalCsExit             Osal_rmCsExit
 
+/**
+ * @brief   The function is used to enter a multi-threaded critical
+ *          section.  Function protects against 
+ *      
+ *          access from multiple threads on single core
+ *
+ * <b> Prototype: </b>
+ *  The following is the C prototype for the expected OSAL API.
+ *
+ *  @verbatim
+       void *Osal_rmMtCsEnter (void *mtSemObj)
+    @endverbatim
+ *      
+ *  <b> Parameter </b>
+ *  @n  Multi-threaded critical section object handle.
+ *
+ *  <b> Return Value </b>
+ *  @n  Handle used to lock the multi-threaded critical section
+ */
+#define Rm_osalMtCsEnter          Osal_rmMtCsEnter
+
+/**
+ * @brief   The function is used to exit a multi-threaded critical
+ *          section protected using Osal_rmMtCsEnter() API.
+ *
+ * <b> Prototype: </b>
+ *  The following is the C prototype for the expected OSAL API.
+ *
+ *  @verbatim
+       void Osal_rmMtCsExit (void *mtSemObj, void *CsHandle)
+    @endverbatim
+ *
+ *  <b> Parameter </b>
+ *  @n  Multi-threaded critical section object handle.
+ *
+ *  <b> Parameter </b>
+ *  @n  Handle for unlocking multi-threaded critical section.
+ *
+ *  <b> Return Value </b>
+ *  @n  Not applicable.
+ */
+#define Rm_osalMtCsExit           Osal_rmMtCsExit
+
 /**
  * @brief   The function is used to indicate that a block of memory is 
  *          about to be accessed. If the memory block is cached then this 
index de3cc4bcc6eec70897ff777561031f154bd187cc..af43b4a9618c644019defbae32bad73f14008f4e 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -1232,10 +1232,14 @@ int32_t Rm_resourceStatus(Rm_Handle rmHandle, int printResources)
     Rm_ResourceTree *treeRoot;
     Rm_ResourceNode *treeNode;
     int32_t          totalResOwners = 0;
-    void            *key; 
+    void            *key;
+    void            *mtKey;
 
-    RM_SS_INST_INV_ENTER_CS(key);
-    RM_SC_INST_INV_ENTER_CS(key);
+    RM_SS_INST_INV_ENTER_CS(rmInst, key);
+    RM_SC_INST_INV_ENTER_CS(rmInst, key);
+    if (rmInst->mtSemObj) {
+        mtKey = Rm_osalMtCsEnter(rmInst->mtSemObj);
+    }
 
     if (rmInst->instType != Rm_instType_CLIENT) {
         Rm_osalLog("Instance name: %s\n", rmInst->instName);
@@ -1271,7 +1275,7 @@ int32_t Rm_resourceStatus(Rm_Handle rmHandle, int printResources)
         }
         
         while (allocator) {
-            RM_SS_OBJ_INV(allocator, Rm_Allocator);
+            RM_SS_OBJ_INV(rmInst, allocator, Rm_Allocator);
             if (printResources) {
                 Rm_osalLog("Resource: %s\n", allocator->resourceName);
             }
@@ -1302,7 +1306,7 @@ int32_t Rm_resourceStatus(Rm_Handle rmHandle, int printResources)
                 else {
                     owners = treeNode->ownerList;
                     while (owners) {
-                        RM_SS_OBJ_INV(owners, Rm_Owner);
+                        RM_SS_OBJ_INV(rmInst, owners, Rm_Owner);
                         if (printResources) {
                             Rm_osalLog("%s (%d) ", owners->instNameNode->name, owners->refCnt);
                         }
@@ -1328,7 +1332,10 @@ int32_t Rm_resourceStatus(Rm_Handle rmHandle, int printResources)
         totalResOwners = RM_ERROR_INVALID_RES_STATUS_INSTANCE;
     }  
 
-    RM_SS_INST_WB_EXIT_CS(key);
+    if (rmInst->mtSemObj) {
+        Rm_osalMtCsExit(rmInst->mtSemObj, mtKey);
+    }
+    RM_SS_INST_WB_EXIT_CS(rmInst, key);
     return(totalResOwners);
 }
 
@@ -1343,10 +1350,14 @@ void Rm_instanceStatus(Rm_Handle rmHandle)
     Rm_Inst        *rmInst = (Rm_Inst *)rmHandle;
     Rm_Transport   *transportList = NULL;
     Rm_Transaction *transactionQ = NULL;
-    void           *key; 
+    void           *key;
+    void           *mtKey;
 
-    RM_SS_INST_INV_ENTER_CS(key);
-    RM_SC_INST_INV_ENTER_CS(key);
+    RM_SS_INST_INV_ENTER_CS(rmInst, key);
+    RM_SC_INST_INV_ENTER_CS(rmInst, key);
+    if (rmInst->mtSemObj) {
+        mtKey = Rm_osalMtCsEnter(rmInst->mtSemObj);
+    }
 
     Rm_osalLog("Instance name: %s\n", rmInst->instName);
     Rm_osalLog("Handle: 0x%08x\n", rmHandle);    
@@ -1377,7 +1388,7 @@ void Rm_instanceStatus(Rm_Handle rmHandle)
     if (transportList) {
         Rm_osalLog("\nRegistered Transports:\n");
         while (transportList) {
-            RM_SS_OBJ_INV(transportList, Rm_Transport);
+            RM_SS_OBJ_INV(rmInst, transportList, Rm_Transport);
             if (transportList->remoteInstType == Rm_instType_SERVER) {
                 Rm_osalLog("    Remote instType:    Server\n");
             }
@@ -1397,7 +1408,7 @@ void Rm_instanceStatus(Rm_Handle rmHandle)
     if (transactionQ) {
         Rm_osalLog("\nQueued Service Transactions:\n");
         while (transactionQ) {
-            RM_SS_OBJ_INV(transactionQ, Rm_Transaction);
+            RM_SS_OBJ_INV(rmInst, transactionQ, Rm_Transaction);
             Rm_osalLog("    Service type:       %d\n", transactionQ->type);
             Rm_osalLog("    Service ID:         %d\n", transactionQ->localId);
             Rm_osalLog("    Service srcInstName %s\n", transactionQ->serviceSrcInstName);
@@ -1411,7 +1422,11 @@ void Rm_instanceStatus(Rm_Handle rmHandle)
             transactionQ = transactionQ->nextTransaction;
         }    
     }
-    RM_SS_INST_WB_EXIT_CS(key);    
+
+    if (rmInst->mtSemObj) {
+        Rm_osalMtCsExit(rmInst->mtSemObj, mtKey);
+    }    
+    RM_SS_INST_WB_EXIT_CS(rmInst, key);    
 }
 
 /* FUNCTION PURPOSE: RM instance creation and initialization
@@ -1452,6 +1467,7 @@ Rm_Handle Rm_init(const Rm_InitCfg *initCfg, int32_t *result)
 
     rmInst->instType = initCfg->instType;    
     rm_strncpy (rmInst->instName, initCfg->instName, RM_NAME_MAX_CHARS);
+    rmInst->mtSemObj = initCfg->mtSemObj;
 
     if ((rmInst->instType == Rm_instType_SERVER) ||
         (rmInst->instType == Rm_instType_SHARED_SERVER)) {
index 0ea83f96d031973aa1b0e75a3b7894e79780a29f..7a7303dcc3dff594bb79743b562d615b78bc663f 100644 (file)
@@ -89,7 +89,7 @@ static Rm_Allocator *allocatorAdd(Rm_Handle rmHandle, const char *resourceName)
                 allocators = allocators->nextAllocator;
             }
             allocators->nextAllocator = newAllocator;
-            RM_SS_OBJ_WB(allocators, Rm_Allocator);
+            RM_SS_OBJ_WB(rmInst, allocators, Rm_Allocator);
         }
         else {
             if ((rmInst->instType == Rm_instType_SERVER) ||
@@ -121,7 +121,7 @@ static int allocatorResNodeIsOwnedBy(Rm_Handle rmHandle, Rm_ResourceNode *node,
     Rm_Owner *owner = node->ownerList;
 
     while (owner) {
-        RM_SS_OBJ_INV(owner, Rm_Owner);
+        RM_SS_OBJ_INV(rmInst, owner, Rm_Owner);
         if (owner->instNameNode == serviceInstNode) {
             return(owner->refCnt);           
         }
@@ -140,10 +140,10 @@ static void allocatorResNodeOwnerRefCntInc(Rm_Handle rmHandle, Rm_ResourceNode *
     Rm_Owner *owner = node->ownerList;
 
     while (owner) {
-        RM_SS_OBJ_INV(owner, Rm_Owner);
+        RM_SS_OBJ_INV(rmInst, owner, Rm_Owner);
         if (owner->instNameNode == serviceInstNode) {
             owner->refCnt++;
-            RM_SS_OBJ_WB(owner, Rm_Owner);
+            RM_SS_OBJ_WB(rmInst, owner, Rm_Owner);
             break;
         }
         owner = owner->nextOwner;
@@ -160,10 +160,10 @@ static void allocatorResNodeOwnerRefCntDec(Rm_Handle rmHandle, Rm_ResourceNode *
     Rm_Owner *owner = node->ownerList;
 
     while (owner) {
-        RM_SS_OBJ_INV(owner, Rm_Owner);
+        RM_SS_OBJ_INV(rmInst, owner, Rm_Owner);
         if (owner->instNameNode == serviceInstNode) {
             owner->refCnt--;
-            RM_SS_OBJ_WB(owner, Rm_Owner);
+            RM_SS_OBJ_WB(rmInst, owner, Rm_Owner);
             break;
         }
         owner = owner->nextOwner;
@@ -180,7 +180,7 @@ static uint16_t allocatorResNodeOwnerGetRefCnt(Rm_Handle rmHandle, Rm_ResourceNo
     Rm_Owner *owner = node->ownerList;
 
     while (owner) {
-        RM_SS_OBJ_INV(owner, Rm_Owner);
+        RM_SS_OBJ_INV(rmInst, owner, Rm_Owner);
         if (owner->instNameNode == serviceInstNode) {
             return (owner->refCnt);
         }
@@ -215,13 +215,13 @@ static void allocatorResNodeOwnerAdd(Rm_Handle rmHandle, Rm_ResourceNode *node,
 
             /* Add owner entry to end of list */
             if (ownerList) {
-                RM_SS_OBJ_INV(ownerList, Rm_Owner);
+                RM_SS_OBJ_INV(rmInst, ownerList, Rm_Owner);
                 while (ownerList->nextOwner) {
                     ownerList = ownerList->nextOwner;
-                    RM_SS_OBJ_INV(ownerList, Rm_Owner);
+                    RM_SS_OBJ_INV(rmInst, ownerList, Rm_Owner);
                 }
                 ownerList->nextOwner = newOwner;
-                RM_SS_OBJ_WB(ownerList, Rm_Owner);
+                RM_SS_OBJ_WB(rmInst, ownerList, Rm_Owner);
             }
             else {
                 node->ownerList = newOwner;
@@ -230,8 +230,8 @@ static void allocatorResNodeOwnerAdd(Rm_Handle rmHandle, Rm_ResourceNode *node,
             node->allocationCount++;
             newOwner->refCnt++;
             newOwner->instNameNode->allocRefCount++;
-            RM_SS_OBJ_WB(newOwner, Rm_Owner);
-            RM_SS_OBJ_WB(newOwner->instNameNode, Rm_PolicyValidInstNode);
+            RM_SS_OBJ_WB(rmInst, newOwner, Rm_Owner);
+            RM_SS_OBJ_WB(rmInst, newOwner->instNameNode, Rm_PolicyValidInstNode);
         }
     }
 }
@@ -286,7 +286,7 @@ static int allocatorResNodeOwnerCompare(Rm_Handle rmHandle, Rm_ResourceNode *nod
 
     if (node1->allocationCount == node2->allocationCount) {
         while (node1Owners) {
-            RM_SS_OBJ_INV(node1Owners, Rm_Owner);
+            RM_SS_OBJ_INV(rmInst, node1Owners, Rm_Owner);
             matchedInst = RM_FALSE;
             while (node2Owners) {
                 if ((node1Owners->instNameNode == node2Owners->instNameNode) &&
@@ -331,7 +331,7 @@ static void allocatorResNodeOwnerDelete(Rm_Handle rmHandle, Rm_ResourceNode *nod
     }
     else {
         while (owner) {
-            RM_SS_OBJ_INV(owner, Rm_Owner);
+            RM_SS_OBJ_INV(rmInst, owner, Rm_Owner);
             if (owner->instNameNode == serviceInstNode) {
                 break;             
             }
@@ -345,12 +345,12 @@ static void allocatorResNodeOwnerDelete(Rm_Handle rmHandle, Rm_ResourceNode *nod
             }
             else {
                 prevOwner->nextOwner = owner->nextOwner;
-                RM_SS_OBJ_WB(prevOwner, Rm_Owner);
+                RM_SS_OBJ_WB(rmInst, prevOwner, Rm_Owner);
             }
             
             node->allocationCount--;
             owner->instNameNode->allocRefCount--;
-            RM_SS_OBJ_WB(owner->instNameNode, Rm_PolicyValidInstNode);
+            RM_SS_OBJ_WB(rmInst, owner->instNameNode, Rm_PolicyValidInstNode);
             Rm_osalFree((void *)owner, sizeof(*owner));
         }
     }
@@ -377,19 +377,19 @@ static void allocatorResNodeOwnerCopy(Rm_Handle rmHandle, Rm_ResourceNode *dstNo
     dstNode->allocationCount = srcNode->allocationCount;
 
     while (srcOwnerList) {
-        RM_SS_OBJ_INV(srcOwnerList, Rm_Owner);
+        RM_SS_OBJ_INV(rmInst, srcOwnerList, Rm_Owner);
         dstNewOwner = Rm_osalMalloc(sizeof(*dstNewOwner));
         dstNewOwner->instNameNode = srcOwnerList->instNameNode;
         dstNewOwner->refCnt = srcOwnerList->refCnt;
         dstNewOwner->nextOwner = NULL;
-        RM_SS_OBJ_WB(dstNewOwner, Rm_Owner);
+        RM_SS_OBJ_WB(rmInst, dstNewOwner, Rm_Owner);
 
         if (dstNode->ownerList == NULL) {
             dstNode->ownerList = dstNewOwner;
         }
         else {
             dstPrevOwner->nextOwner = dstNewOwner;
-            RM_SS_OBJ_WB(dstPrevOwner, Rm_Owner);
+            RM_SS_OBJ_WB(rmInst, dstPrevOwner, Rm_Owner);
         }
         dstPrevOwner = dstNewOwner;
         srcOwnerList = srcOwnerList->nextOwner;
@@ -408,11 +408,11 @@ static void allocatorResNodeOwnerClear(Rm_Handle rmHandle, Rm_ResourceNode *node
     Rm_Owner *nextOwner;
 
     while (owner) {
-        RM_SS_OBJ_INV(owner, Rm_Owner);
+        RM_SS_OBJ_INV(rmInst, owner, Rm_Owner);
         nextOwner = owner->nextOwner;
         node->allocationCount--;
         owner->instNameNode->allocRefCount--;
-        RM_SS_OBJ_WB(owner->instNameNode, Rm_PolicyValidInstNode);
+        RM_SS_OBJ_WB(rmInst, owner->instNameNode, Rm_PolicyValidInstNode);
         Rm_osalFree((void *)owner, sizeof(*owner));
         owner = nextOwner;
     }
@@ -1434,7 +1434,7 @@ int32_t rmAllocatorCreate(Rm_Handle rmHandle, const char *resourceName, Rm_Resou
         }
         
         allocator->allocatorRootEntry = treeRoot;
-        RM_SS_OBJ_WB(allocator, Rm_Allocator);
+        RM_SS_OBJ_WB(rmInst, allocator, Rm_Allocator);
         return (RM_OK);
     }
     else {
@@ -1473,7 +1473,7 @@ Rm_Allocator *rmAllocatorFind(Rm_Handle rmHandle, const char *resourceName)
     Rm_Allocator *allocatorList = rmAllocatorGetAllocatorList(rmHandle);
     
     while (allocatorList) {
-        RM_SS_OBJ_INV(allocatorList, Rm_Allocator);
+        RM_SS_OBJ_INV(rmInst, allocatorList, Rm_Allocator);
         if (strncmp(allocatorList->resourceName, resourceName, RM_NAME_MAX_CHARS) == 0) {
             break;             
         }
@@ -1733,7 +1733,7 @@ int32_t rmAllocatorDelete(Rm_Handle rmHandle, const char *resourceName)
         }
         else {
             prevAllocator->nextAllocator = allocator->nextAllocator;
-            RM_SS_OBJ_WB(prevAllocator, Rm_Allocator);
+            RM_SS_OBJ_WB(rmInst, prevAllocator, Rm_Allocator);
         }
             
         /* Destroy tree and return error */
@@ -1769,7 +1769,7 @@ void rmAllocatorDeleteResources(Rm_Handle rmHandle)
     Rm_ResourceNode *nextResNode;
 
     while (allocatorList) {
-        RM_SS_OBJ_INV(allocatorList, Rm_Allocator);
+        RM_SS_OBJ_INV(rmInst, allocatorList, Rm_Allocator);
         nextAllocator = allocatorList->nextAllocator;
         resTree = allocatorList->allocatorRootEntry;
 
index 5fc9d9d7b39402ce17457a2f01894901b40d632c..9fa8d3b8abdbc6c39e9473b817c41c7537153065 100644 (file)
@@ -165,7 +165,7 @@ void rmNameServerInit(Rm_Handle rmHandle)
 
     rootEntry = Rm_osalMalloc(sizeof(Rm_NameServerTree));
     RB_INIT(rootEntry);
-    RM_SS_OBJ_WB(rootEntry, Rm_NameServerTree);
+    RM_SS_OBJ_WB(rmInst, rootEntry, Rm_NameServerTree);
     rmInst->u.server.nameServer = rootEntry;
 }
 
index bccd886ad5379b69d9db666c11b550ee3ce4934b..32b214cf3d7b782dcd6a2509bd11ac6d8d006829 100644 (file)
@@ -93,11 +93,15 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
     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);
+    void           *key;
+    void           *mtKey;
 
+    RM_SS_INST_INV_ENTER_CS(rmInst, key);
+    RM_SC_INST_INV_ENTER_CS(rmInst, key);
+    if (rmInst->mtSemObj) {
+        mtKey = Rm_osalMtCsEnter(rmInst->mtSemObj);
+    }
+    
     if (rmInst->isLocked) {
         serviceResponse->serviceState = RM_SERVICE_DENIED_RM_INSTANCE_LOCKED;
         return;
@@ -199,7 +203,11 @@ void Rm_serviceHandler (void *rmHandle, const Rm_ServiceReqInfo *serviceRequest,
     else {
         serviceResponse->serviceState = RM_ERROR_SERVICE_TRANS_NOT_CREATED;    
     }
-    RM_SS_INST_WB_EXIT_CS(key);
+    
+    if (rmInst->mtSemObj) {
+        Rm_osalMtCsExit(rmInst->mtSemObj, mtKey);
+    }
+    RM_SS_INST_WB_EXIT_CS(rmInst, key);
     return;
 }
 
@@ -213,8 +221,12 @@ Rm_ServiceHandle *Rm_serviceOpenHandle(Rm_Handle rmHandle, int32_t *result)
     Rm_Inst          *rmInst = (Rm_Inst *)rmHandle;
     Rm_ServiceHandle *serviceHandle = NULL;
     void             *key;
+    void             *mtKey;
     
-    RM_SS_INST_INV_ENTER_CS(key);
+    RM_SS_INST_INV_ENTER_CS(rmInst, key);
+    if (rmInst->mtSemObj) {
+        mtKey = Rm_osalMtCsEnter(rmInst->mtSemObj);
+    }
 
     *result = RM_OK;
 
@@ -224,14 +236,18 @@ Rm_ServiceHandle *Rm_serviceOpenHandle(Rm_Handle rmHandle, int32_t *result)
         if (serviceHandle) {
             serviceHandle->rmHandle = rmHandle;
             serviceHandle->Rm_serviceHandler = Rm_serviceHandler;
-            RM_SS_OBJ_WB(serviceHandle, Rm_ServiceHandle);
+            RM_SS_OBJ_WB(rmInst, serviceHandle, Rm_ServiceHandle);
             rmInst->serviceHandle = serviceHandle;
         }
         else {
             *result = RM_ERROR_SERVICE_HANDLE_MEM_ALLOC_FAILED;
         }
     }
-    RM_SS_INST_WB_EXIT_CS(key);
+    
+    if (rmInst->mtSemObj) {
+        Rm_osalMtCsExit(rmInst->mtSemObj, mtKey);
+    }    
+    RM_SS_INST_WB_EXIT_CS(rmInst, key);
     return (serviceHandle);
 }
 
@@ -244,8 +260,12 @@ int32_t Rm_serviceCloseHandle(Rm_ServiceHandle *rmServiceHandle)
     Rm_Inst *rmInst = (Rm_Inst *)rmServiceHandle->rmHandle;
     int32_t  retVal = RM_OK;
     void    *key;
+    void    *mtKey;
 
-    RM_SS_INST_INV_ENTER_CS(key);
+    RM_SS_INST_INV_ENTER_CS(rmInst, key);
+    if (rmInst->mtSemObj) {
+        mtKey = Rm_osalMtCsEnter(rmInst->mtSemObj);
+    }
 
     if (rmInst->serviceHandle) {
         Rm_osalFree((void *)rmServiceHandle, sizeof(*rmServiceHandle));
@@ -254,7 +274,11 @@ int32_t Rm_serviceCloseHandle(Rm_ServiceHandle *rmServiceHandle)
     else {
         retVal = RM_ERROR_SERVICE_HANDLE_ALREADY_CLOSED;
     }
-    RM_SS_INST_WB_EXIT_CS(key);
+    
+    if (rmInst->mtSemObj) {
+        Rm_osalMtCsExit(rmInst->mtSemObj, mtKey);
+    }    
+    RM_SS_INST_WB_EXIT_CS(rmInst, key);
     return(retVal);
 }
 
index 7f4ab0a6be5e73e20c2ff8c4eba358fb822728f5..6c1847ead2da587de17baf72e82674b08bd27e13 100644 (file)
@@ -239,10 +239,14 @@ Rm_TransportHandle Rm_transportRegister (const Rm_TransportCfg *transportCfg, in
     Rm_Inst      *rmInst = (Rm_Inst *) transportCfg->rmHandle;\r
     Rm_Transport *transport = NULL;\r
     void         *key;\r
+    void         *mtKey;\r
 \r
     *result = RM_OK;\r
 \r
-    RM_SS_INST_INV_ENTER_CS(key);\r
+    RM_SS_INST_INV_ENTER_CS(rmInst, key);\r
+    if (rmInst->mtSemObj) {\r
+        mtKey = Rm_osalMtCsEnter(rmInst->mtSemObj);\r
+    }\r
 \r
     /* Shared servers and clients cannot connect to anyone */\r
     if ((rmInst->instType == Rm_instType_SHARED_SERVER) ||\r
@@ -291,8 +295,12 @@ Rm_TransportHandle Rm_transportRegister (const Rm_TransportCfg *transportCfg, in
         (transport->remoteInstType == Rm_instType_SERVER)) {\r
         rmInst->registeredWithDelegateOrServer = RM_TRUE;\r
     }\r
+    \r
 errorExit:\r
-    RM_SS_INST_WB_EXIT_CS(key);    \r
+    if (rmInst->mtSemObj) {\r
+        Rm_osalMtCsExit(rmInst->mtSemObj, mtKey);\r
+    }    \r
+    RM_SS_INST_WB_EXIT_CS(rmInst, key);    \r
     return ((Rm_TransportHandle) transport);\r
 }\r
 \r
@@ -307,9 +315,13 @@ int32_t Rm_transportReconfig (Rm_TransportHandle transportHandle, const Rm_Trans
     Rm_Transport *transport = (Rm_Transport *)transportHandle;\r
     Rm_Inst      *rmInst = (Rm_Inst *)transport->rmHandle;\r
     void         *key;\r
+    void         *mtKey;\r
     int32_t       retVal = RM_OK;\r
 \r
-    RM_SS_INST_INV_ENTER_CS(key);\r
+    RM_SS_INST_INV_ENTER_CS(rmInst, key);\r
+    if (rmInst->mtSemObj) {\r
+        mtKey = Rm_osalMtCsEnter(rmInst->mtSemObj);\r
+    }\r
 \r
     if (transportIsRegistered(transport->rmHandle, transport)) {\r
         /* Reconfigure existing transport's appTransportHandle.  Used in cases where instances\r
@@ -327,7 +339,10 @@ int32_t Rm_transportReconfig (Rm_TransportHandle transportHandle, const Rm_Trans
         retVal = RM_ERROR_TRANSPORT_HANDLE_DOES_NOT_EXIST;\r
     }        \r
 \r
-    RM_SS_INST_WB_EXIT_CS(key);    \r
+    if (rmInst->mtSemObj) {\r
+        Rm_osalMtCsExit(rmInst->mtSemObj, mtKey);\r
+    }\r
+    RM_SS_INST_WB_EXIT_CS(rmInst, key);    \r
     return (retVal);\r
 }\r
 \r
index 03fa8aae692b4244dc3b7f8a654a9ad115a78199..9b94b489291a2f3a077ebb3aab99d841039c20e7 100644 (file)
@@ -113,6 +113,27 @@ void Osal_rmCsExit(void *CsHandle)
 
 }
 
+/* FUNCTION PURPOSE: Multi-threaded critical section enter
+ ***********************************************************************
+ * DESCRIPTION: The function is used to enter a multi-threaded critical
+ *              section. Function protects against 
+ *      
+ *              access from multiple threads on single core
+ */  
+void *Osal_rmMtCsEnter(void *mtSemObj)
+{
+    return NULL;
+}
+
+/* FUNCTION PURPOSE: Multi-threaded critical section exit
+ ***********************************************************************
+ * DESCRIPTION: The function is used to exit a multi-threaded critical
+ *              section protected using Osal_rmMtCsEnter() API.
+ */  
+void Osal_rmMtCsExit(void *mtSemObj, void *CsHandle)
+{
+}
+
 /* FUNCTION PURPOSE: Cache invalidate
  ***********************************************************************
  * DESCRIPTION: The function is used to indicate that a block of memory is 
index 35329e600104ebc4b508e7e6db18ddd6b5148912..cd7be6015fedb4bdab0fd0eb642d370ada2cbd1a 100644 (file)
@@ -124,6 +124,29 @@ void Osal_rmCsExit(void *CsHandle)
 
 }
 
+/* FUNCTION PURPOSE: Multi-threaded critical section enter
+ ***********************************************************************
+ * DESCRIPTION: The function is used to enter a multi-threaded critical
+ *              section. Function protects against 
+ *      
+ *              access from multiple threads on single core
+ */  
+void *Osal_rmMtCsEnter(void *mtSemObj)
+{
+
+    return NULL;
+}
+
+/* FUNCTION PURPOSE: Multi-threaded critical section exit
+ ***********************************************************************
+ * DESCRIPTION: The function is used to exit a multi-threaded critical
+ *              section protected using Osal_rmMtCsEnter() API.
+ */  
+void Osal_rmMtCsExit(void *mtSemObj, void *CsHandle)
+{
+
+}
+
 /* FUNCTION PURPOSE: Cache invalidate
  ***********************************************************************
  * DESCRIPTION: The function is used to indicate that a block of memory is 
index 6b8d806b0068cf96d8160570c0937340fd24ddef..62fda05df694f4f35a50a0f905dcd9ddb6cbef89 100644 (file)
@@ -122,13 +122,36 @@ void *Osal_rmCsEnter(void)
 /* FUNCTION PURPOSE: Critical section exit
  ***********************************************************************
  * DESCRIPTION: The function is used to exit a critical section 
- *              protected using Osal_cppiCsEnter() API.
+ *              protected using Osal_rmCsEnter() API.
  */  
 void Osal_rmCsExit(void *CsHandle)
 {
 
 }
 
+/* FUNCTION PURPOSE: Multi-threaded critical section enter
+ ***********************************************************************
+ * DESCRIPTION: The function is used to enter a multi-threaded critical
+ *              section. Function protects against 
+ *      
+ *              access from multiple threads on single core
+ */  
+void *Osal_rmMtCsEnter(void *mtSemObj)
+{
+
+    return NULL;
+}
+
+/* FUNCTION PURPOSE: Multi-threaded critical section exit
+ ***********************************************************************
+ * DESCRIPTION: The function is used to exit a multi-threaded critical
+ *              section protected using Osal_rmMtCsEnter() API.
+ */  
+void Osal_rmMtCsExit(void *mtSemObj, void *CsHandle)
+{
+
+}
+
 /* FUNCTION PURPOSE: Cache invalidate
  ***********************************************************************
  * DESCRIPTION: The function is used to indicate that a block of memory is 
index 6b8d806b0068cf96d8160570c0937340fd24ddef..62fda05df694f4f35a50a0f905dcd9ddb6cbef89 100644 (file)
@@ -122,13 +122,36 @@ void *Osal_rmCsEnter(void)
 /* FUNCTION PURPOSE: Critical section exit
  ***********************************************************************
  * DESCRIPTION: The function is used to exit a critical section 
- *              protected using Osal_cppiCsEnter() API.
+ *              protected using Osal_rmCsEnter() API.
  */  
 void Osal_rmCsExit(void *CsHandle)
 {
 
 }
 
+/* FUNCTION PURPOSE: Multi-threaded critical section enter
+ ***********************************************************************
+ * DESCRIPTION: The function is used to enter a multi-threaded critical
+ *              section. Function protects against 
+ *      
+ *              access from multiple threads on single core
+ */  
+void *Osal_rmMtCsEnter(void *mtSemObj)
+{
+
+    return NULL;
+}
+
+/* FUNCTION PURPOSE: Multi-threaded critical section exit
+ ***********************************************************************
+ * DESCRIPTION: The function is used to exit a multi-threaded critical
+ *              section protected using Osal_rmMtCsEnter() API.
+ */  
+void Osal_rmMtCsExit(void *mtSemObj, void *CsHandle)
+{
+
+}
+
 /* FUNCTION PURPOSE: Cache invalidate
  ***********************************************************************
  * DESCRIPTION: The function is used to indicate that a block of memory is 
index 0b6326561f39fde0e222450f72bc274cd51f850f..58f636abdf467042abdd3e3837b3983577a055da 100644 (file)
@@ -146,7 +146,7 @@ void *Osal_rmCsEnter(void)
 /* FUNCTION PURPOSE: Critical section exit
  ***********************************************************************
  * DESCRIPTION: The function is used to exit a critical section 
- *              protected using Osal_cppiCsEnter() API.
+ *              protected using Osal_rmCsEnter() API.
  */  
 void Osal_rmCsExit(void *CsHandle)
 {
@@ -154,6 +154,29 @@ void Osal_rmCsExit(void *CsHandle)
     CSL_semReleaseSemaphore (RM_HW_SEM);
 }
 
+/* FUNCTION PURPOSE: Multi-threaded critical section enter
+ ***********************************************************************
+ * DESCRIPTION: The function is used to enter a multi-threaded critical
+ *              section. Function protects against 
+ *      
+ *              access from multiple threads on single core
+ */  
+void *Osal_rmMtCsEnter(void *mtSemObj)
+{
+
+    return NULL;
+}
+
+/* FUNCTION PURPOSE: Multi-threaded critical section exit
+ ***********************************************************************
+ * DESCRIPTION: The function is used to exit a multi-threaded critical
+ *              section protected using Osal_rmMtCsEnter() API.
+ */  
+void Osal_rmMtCsExit(void *mtSemObj, void *CsHandle)
+{
+
+}
+
 /* FUNCTION PURPOSE: Cache invalidate
  ***********************************************************************
  * DESCRIPTION: The function is used to indicate that a block of memory is 
index 6b8d806b0068cf96d8160570c0937340fd24ddef..62fda05df694f4f35a50a0f905dcd9ddb6cbef89 100644 (file)
@@ -122,13 +122,36 @@ void *Osal_rmCsEnter(void)
 /* FUNCTION PURPOSE: Critical section exit
  ***********************************************************************
  * DESCRIPTION: The function is used to exit a critical section 
- *              protected using Osal_cppiCsEnter() API.
+ *              protected using Osal_rmCsEnter() API.
  */  
 void Osal_rmCsExit(void *CsHandle)
 {
 
 }
 
+/* FUNCTION PURPOSE: Multi-threaded critical section enter
+ ***********************************************************************
+ * DESCRIPTION: The function is used to enter a multi-threaded critical
+ *              section. Function protects against 
+ *      
+ *              access from multiple threads on single core
+ */  
+void *Osal_rmMtCsEnter(void *mtSemObj)
+{
+
+    return NULL;
+}
+
+/* FUNCTION PURPOSE: Multi-threaded critical section exit
+ ***********************************************************************
+ * DESCRIPTION: The function is used to exit a multi-threaded critical
+ *              section protected using Osal_rmMtCsEnter() API.
+ */  
+void Osal_rmMtCsExit(void *mtSemObj, void *CsHandle)
+{
+
+}
+
 /* FUNCTION PURPOSE: Cache invalidate
  ***********************************************************************
  * DESCRIPTION: The function is used to indicate that a block of memory is 
index 0b6326561f39fde0e222450f72bc274cd51f850f..58f636abdf467042abdd3e3837b3983577a055da 100644 (file)
@@ -146,7 +146,7 @@ void *Osal_rmCsEnter(void)
 /* FUNCTION PURPOSE: Critical section exit
  ***********************************************************************
  * DESCRIPTION: The function is used to exit a critical section 
- *              protected using Osal_cppiCsEnter() API.
+ *              protected using Osal_rmCsEnter() API.
  */  
 void Osal_rmCsExit(void *CsHandle)
 {
@@ -154,6 +154,29 @@ void Osal_rmCsExit(void *CsHandle)
     CSL_semReleaseSemaphore (RM_HW_SEM);
 }
 
+/* FUNCTION PURPOSE: Multi-threaded critical section enter
+ ***********************************************************************
+ * DESCRIPTION: The function is used to enter a multi-threaded critical
+ *              section. Function protects against 
+ *      
+ *              access from multiple threads on single core
+ */  
+void *Osal_rmMtCsEnter(void *mtSemObj)
+{
+
+    return NULL;
+}
+
+/* FUNCTION PURPOSE: Multi-threaded critical section exit
+ ***********************************************************************
+ * DESCRIPTION: The function is used to exit a multi-threaded critical
+ *              section protected using Osal_rmMtCsEnter() API.
+ */  
+void Osal_rmMtCsExit(void *mtSemObj, void *CsHandle)
+{
+
+}
+
 /* FUNCTION PURPOSE: Cache invalidate
  ***********************************************************************
  * DESCRIPTION: The function is used to indicate that a block of memory is 
index 6b8d806b0068cf96d8160570c0937340fd24ddef..62fda05df694f4f35a50a0f905dcd9ddb6cbef89 100644 (file)
@@ -122,13 +122,36 @@ void *Osal_rmCsEnter(void)
 /* FUNCTION PURPOSE: Critical section exit
  ***********************************************************************
  * DESCRIPTION: The function is used to exit a critical section 
- *              protected using Osal_cppiCsEnter() API.
+ *              protected using Osal_rmCsEnter() API.
  */  
 void Osal_rmCsExit(void *CsHandle)
 {
 
 }
 
+/* FUNCTION PURPOSE: Multi-threaded critical section enter
+ ***********************************************************************
+ * DESCRIPTION: The function is used to enter a multi-threaded critical
+ *              section. Function protects against 
+ *      
+ *              access from multiple threads on single core
+ */  
+void *Osal_rmMtCsEnter(void *mtSemObj)
+{
+
+    return NULL;
+}
+
+/* FUNCTION PURPOSE: Multi-threaded critical section exit
+ ***********************************************************************
+ * DESCRIPTION: The function is used to exit a multi-threaded critical
+ *              section protected using Osal_rmMtCsEnter() API.
+ */  
+void Osal_rmMtCsExit(void *mtSemObj, void *CsHandle)
+{
+
+}
+
 /* FUNCTION PURPOSE: Cache invalidate
  ***********************************************************************
  * DESCRIPTION: The function is used to indicate that a block of memory is 
index 0b6326561f39fde0e222450f72bc274cd51f850f..58f636abdf467042abdd3e3837b3983577a055da 100644 (file)
@@ -146,7 +146,7 @@ void *Osal_rmCsEnter(void)
 /* FUNCTION PURPOSE: Critical section exit
  ***********************************************************************
  * DESCRIPTION: The function is used to exit a critical section 
- *              protected using Osal_cppiCsEnter() API.
+ *              protected using Osal_rmCsEnter() API.
  */  
 void Osal_rmCsExit(void *CsHandle)
 {
@@ -154,6 +154,29 @@ void Osal_rmCsExit(void *CsHandle)
     CSL_semReleaseSemaphore (RM_HW_SEM);
 }
 
+/* FUNCTION PURPOSE: Multi-threaded critical section enter
+ ***********************************************************************
+ * DESCRIPTION: The function is used to enter a multi-threaded critical
+ *              section. Function protects against 
+ *      
+ *              access from multiple threads on single core
+ */  
+void *Osal_rmMtCsEnter(void *mtSemObj)
+{
+
+    return NULL;
+}
+
+/* FUNCTION PURPOSE: Multi-threaded critical section exit
+ ***********************************************************************
+ * DESCRIPTION: The function is used to exit a multi-threaded critical
+ *              section protected using Osal_rmMtCsEnter() API.
+ */  
+void Osal_rmMtCsExit(void *mtSemObj, void *CsHandle)
+{
+
+}
+
 /* FUNCTION PURPOSE: Cache invalidate
  ***********************************************************************
  * DESCRIPTION: The function is used to indicate that a block of memory is