Don not copy frame data to datagram memory, if datagram type is write-only.
authorFlorian Pose <fp@igh-essen.com>
Fri, 16 Sep 2011 12:44:54 +0200
changeset 2116 1448a40b5af5
parent 2113 26e61c7b75a1
child 2117 afb40fd6018e
Don not copy frame data to datagram memory, if datagram type is write-only.
master/master.c
--- a/master/master.c	Fri Sep 16 09:25:02 2011 +0200
+++ b/master/master.c	Fri Sep 16 12:44:54 2011 +0200
@@ -1172,8 +1172,12 @@
                 domain_data += domain_fmmu->data_size;
                 i++;
             }
-        } else {
-            // copy received data into the datagram memory
+        } else if (datagram->type != EC_DATAGRAM_APWR &&
+                datagram->type != EC_DATAGRAM_FPWR &&
+                datagram->type != EC_DATAGRAM_BWR &&
+                datagram->type != EC_DATAGRAM_LWR) {
+            // copy received data into the datagram memory,
+            // if something has been read
             memcpy(datagram->data, frame_datagram_data, data_size);
         }