]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blobdiff - packages/ti/grcm/RcmServer.c
grcm: Only Assert on Received Message Checks if Shutdown is False
[ipc/ipcdev.git] / packages / ti / grcm / RcmServer.c
index 40a6b54c7d11a9919413c3833a9d6d2afce810a0..fb4a180061dc1f3b83d3ed7192f21aa417250952 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * Copyright (c) 2011-2014, Texas Instruments Incorporated
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,6 +58,8 @@
 #include <xdc/runtime/knl/Thread.h>
 #include <xdc/runtime/System.h>
 
+#include <ti/sysbios/knl/Task.h>
+
 #define MSGBUFFERSIZE    512   /* Make global and move to RPMessage.h */
 
 #if defined(RCM_ti_ipc)
@@ -1191,7 +1193,7 @@ Int RcmServer_addSymbol(RcmServer_Object *obj, String funcName,
 
         _strcpy(slot->name, funcName);
         slot->key = RcmServer_getNextKey_P(obj);
-        fxnIdx = (slot->key << _RCM_KeyShift) | (i << 12) | j;
+        fxnIdx = ((UInt32)(slot->key) << _RCM_KeyShift) | (i << 12) | j;
     }
 
     /* error, no more room to add new symbol */
@@ -1527,6 +1529,7 @@ Int RcmServer_execMsg_I(RcmServer_Object *obj, RcmClient_Message *msg)
         System_printf("RcmServer_execMsg_I: Calling fxnIdx: %d\n",
                       (msg->fxnIdx & 0x0000FFFF));
 #endif
+        Task_setEnv(Task_self(), (Ptr)RcmServer_getLocalAddress(obj));
 #if USE_RPMESSAGE
         if (createFxn)  {
             msg->result = (*createFxn)(obj, msg->dataSize, msg->data);
@@ -1537,6 +1540,7 @@ Int RcmServer_execMsg_I(RcmServer_Object *obj, RcmClient_Message *msg)
 #else
         msg->result = (*fxn)(msg->dataSize, msg->data);
 #endif
+        Task_setEnv(Task_self(), NULL);
     }
 
     return(status);
@@ -1672,7 +1676,8 @@ Int RcmServer_getSymIdx_P(RcmServer_Object *obj, String name, UInt32 *index)
                     if (i == 0) {
                         fxnIdx = 0x80000000 | j;
                     } else {
-                        fxnIdx = (slot->key << _RCM_KeyShift) | (i << 12) | j;
+                        fxnIdx = ((UInt32)(slot->key) << _RCM_KeyShift) |
+                                (i << 12) | j;
                     }
                     break;
                 }
@@ -2174,17 +2179,19 @@ Void RcmServer_serverThrFxn_P(IArg arg)
                           "from: %d\n",
                          len, obj->replyAddr);
 
-            System_printf("hdr - t:%d f:%d l:%d\n", packet->hdr.type,
-                          packet->hdr.flags, packet->hdr.len);
+            System_printf("hdr - t:%d l:%d\n", packet->hdr.type,
+                          packet->hdr.len);
 
             System_printf("pkt - d:%d m:%d\n", packet->desc, packet->msgId);
 #endif
             if (packet->hdr.type == OMX_DISC_REQ) {
                 System_printf("RcmServer_serverThrFxn_P: Got OMX_DISCONNECT\n");
             }
-            Assert_isTrue((len <= MSGBUFFERSIZE), NULL);
-            Assert_isTrue((packet->hdr.type == OMX_RAW_MSG) ||
-                          (packet->hdr.type == OMX_DISC_REQ) , NULL);
+            if (!obj->shutdown) {
+                Assert_isTrue((len <= MSGBUFFERSIZE), NULL);
+                Assert_isTrue((packet->hdr.type == OMX_RAW_MSG) ||
+                              (packet->hdr.type == OMX_DISC_REQ) , NULL);
+            }
 
             if ((rval < 0) && (rval != RPMessage_E_UNBLOCKED)) {
 #else