From 487ea5bea1222168f30415b786976f7afd0efdbb Mon Sep 17 00:00:00 2001
From: Florian Pose <fp@igh-essen.com>
Date: Wed, 6 May 2009 15:06:46 +0000
Subject: [PATCH] Always set DC reference clock to OP.

---
 TODO            | 1 -
 master/master.c | 6 ++++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/TODO b/TODO
index 877d2881..c8f5c792 100644
--- a/TODO
+++ b/TODO
@@ -14,7 +14,6 @@ Version 1.5.0:
     - Check 32/64 bit operations.
     - Use vendor correction factors when calculating transmission delays.
     - Skip setting system time offset when application detached.
-    - Always set reference clock to OP.
     - Output DC configuration in 'ethercat config'.
     - How to set the SYNC1 shift time?
     - Do not output graph, if topology calculation failed.
diff --git a/master/master.c b/master/master.c
index 2776c157..1c4b0b8c 100644
--- a/master/master.c
+++ b/master/master.c
@@ -555,6 +555,7 @@ int ec_master_enter_operation_phase(ec_master_t *master /**< EtherCAT master */)
             slave++) {
         ec_slave_request_state(slave, EC_SLAVE_STATE_PREOP);
     }
+
 #ifdef EC_EOE
     // ... but set EoE slaves to OP
     list_for_each_entry(eoe, &master->eoe_handlers, list) {
@@ -1548,6 +1549,11 @@ int ecrt_master_activate(ec_master_t *master)
         domain_offset += domain->data_size;
     }
     
+    // always set DC reference clock to OP
+    if (master->dc_ref_clock) {
+        ec_slave_request_state(master->dc_ref_clock, EC_SLAVE_STATE_OP);
+    }
+
     up(&master->master_sem);
 
     // restart EoE process and master thread with new locking
-- 
GitLab