Added debugging output for unmatched frames and those that timed out.
authorFlorian Pose <fp@igh-essen.com>
Tue, 07 Aug 2007 13:33:57 +0000
changeset 684 bf991809dcf0
parent 683 43700671b37a
child 685 3e7828ef0cd8
Added debugging output for unmatched frames and those that timed out.
master/master.c
--- a/master/master.c	Tue Aug 07 13:33:21 2007 +0000
+++ b/master/master.c	Tue Aug 07 13:33:57 2007 +0000
@@ -718,6 +718,14 @@
         if (!matched) {
             master->stats.unmatched++;
             ec_master_output_stats(master);
+
+            if (unlikely(master->debug_level > 0)) {
+                EC_DBG("UNMATCHED datagram:\n");
+                ec_print_data(cur_data - EC_DATAGRAM_HEADER_SIZE,
+                        EC_DATAGRAM_HEADER_SIZE + data_size
+                        + EC_DATAGRAM_FOOTER_SIZE);
+            }
+
             cur_data += data_size + EC_DATAGRAM_FOOTER_SIZE;
             continue;
         }
@@ -1504,6 +1512,13 @@
             datagram->state = EC_DATAGRAM_TIMED_OUT;
             master->stats.timeouts++;
             ec_master_output_stats(master);
+
+            if (unlikely(master->debug_level > 0)) {
+                EC_DBG("TIMED OUT datagram index %02X waited %u us.\n",
+                        datagram->index,
+                        (unsigned int) (master->main_device.cycles_poll
+                            - datagram->cycles_sent) * 1000 / cpu_khz);
+            }
         }
     }