Resolved SDOCM00101586. Added test cases to cover resolved issued
[keystone-rtos/rm-lld.git] / include / rm_internal.h
index 9d27365a8a4ca82f68c780b8b9d529dd1a5b7028..40a56e0d2520f3bb61d5416813a699ebc07c3189 100644 (file)
@@ -47,9 +47,50 @@ extern "C" {
 /* RM external includes */
 #include <ti/drv/rm/rm.h>
 
+/* RM OSAL layer */
+#include <rm_osal.h>
+
 /* RM true/false definitions */
-#define RM_FALSE 0
-#define RM_TRUE  1
+#define RM_BOOL_UNDEF (-1)
+#define RM_FALSE      0
+#define RM_TRUE       1
+
+/* RM cache alignment */
+#define RM_MAX_CACHE_ALIGN 128
+
+/* Shared server enter critical section macro */
+#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 */
+#define RM_SS_INST_WB_EXIT_CS(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)                          \
+    if (rmInst->instType == Rm_instType_SHARED_SERVER) {     \
+        Rm_osalBeginMemAccess((void *)obj, sizeof(objType)); \
+    }
+
+/* Shared server writeback macro */
+#define RM_SS_OBJ_WB(obj, objType)                         \
+    if (rmInst->instType == Rm_instType_SHARED_SERVER) {   \
+        Rm_osalEndMemAccess((void *)obj, sizeof(objType)); \
+    }    
 
 /* RM resource information */
 typedef struct {
@@ -61,6 +102,9 @@ typedef struct {
     uint32_t length;
     /* Resource alignment */
     int32_t  alignment;
+    /* Resource owner count - number of instances that are in the
+     * resource's owner list */
+    int32_t  ownerCount;
     /* NameServer name tied to resource */
     char     nameServerName[RM_NAME_MAX_CHARS];
 } Rm_ResourceInfo;