Shared memory cache management
[ipc/ipcdev.git] / packages / ti / sdo / ipc / transports / TransportShmNotify.c
index 78b53eaee608c46c87ce8a79d37255c78bbed10a..95a16e6746c16f40426566c431d86a11e7b604e3 100644 (file)
@@ -70,9 +70,25 @@ Void TransportShmNotify_notifyFxn(UInt16 procId,
 {
     UInt32 queueId;
     MessageQ_Msg msg;
 {
     UInt32 queueId;
     MessageQ_Msg msg;
+    UInt16 regionId;
 
     msg = SharedRegion_getPtr((SharedRegion_SRPtr)payload);
 
 
     msg = SharedRegion_getPtr((SharedRegion_SRPtr)payload);
 
+    /* Read new data into memory instead of old data from cache */
+    regionId = SharedRegion_getId(msg);
+    if (SharedRegion_isCacheEnabled(regionId)) {
+        /* invalidate header before reading header */
+        Cache_inv(msg,
+                  sizeof(MessageQ_MsgHeader),
+                  Cache_Type_ALL,
+                  TRUE);
+        /* invalidate the rest of the message */
+        Cache_inv(((char *)msg) + sizeof(MessageQ_MsgHeader),
+                  msg->msgSize - sizeof(MessageQ_MsgHeader),
+                  Cache_Type_ALL,
+                  TRUE);
+    }
+
     queueId = MessageQ_getDstQueue(msg);
 
     MessageQ_put(queueId, msg);
     queueId = MessageQ_getDstQueue(msg);
 
     MessageQ_put(queueId, msg);