[etherlab-dev] EC_FIND_SLAVE when alias != 0 is incorrect

Gavin Lambert gavinl at compacsort.com
Tue Apr 28 01:05:19 CEST 2015


No, the original code is correct.

 

EtherCAT slaves can be addressed in one of two ways:

 

1.       0, abs_ring_pos => where abs_ring_pos is the absolute position in the virtual ring (0 is the first slave).

2.       alias, rel_ring_pos => where alias is the alias of some slave and rel_ring_pos is the *relative* offset from that slave (0 is the slave with that alias, 1 is the first slave after that one, etc).

 

The change you posted below breaks both of these.  If it is “working” for you, then it is only by coincidence as a result of you passing incorrect parameters.

 

From: etherlab-dev [mailto:etherlab-dev-bounces at etherlab.org] On Behalf Of Raz
Sent: Monday, 27 April 2015 21:02
To: etherlab-dev at etherlab.org
Subject: [etherlab-dev] EC_FIND_SLAVE when alias != 0 is incorrect

 

when alias is used EC_FIND_SLAVE fails to find slave at position greater than 0


>From 1349cabe197e84208a196d9186111551f24e25f5 Mon Sep 17 00:00:00 2001
From: raz <raziebe at gmail.com <mailto:raziebe at gmail.com> >
Date: Mon, 27 Apr 2015 11:51:23 +0300
Subject: [PATCH] alias search incorrect

---
 drivers/misc/ethercat_master/master/master.c | 6 +++---

diff --git a/drivers/misc/ethercat_master/master/master.c b/drivers/misc/ethercat_master/master/master.c
index 34cc1b5..d9ec5b3 100644
--- a/drivers/misc/ethercat_master/master/master.c
+++ b/drivers/misc/ethercat_master/master/master.c
@@ -1569,9 +1569,9 @@ void ec_master_attach_slave_configs(
             } \
             if (slave == master->slaves + master->slave_count) \
             return NULL; \
-        } \
-        \
-        slave += position; \
+        } else{ \
+               slave += position; \
+       } \
         if (slave < master->slaves + master->slave_count) { \
             return slave; \
         } else { \
-- 
1.9.1


-- 

https://sites.google.com/site/ironspeedlinux/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-dev/attachments/20150428/838f589f/attachment.html>


More information about the etherlab-dev mailing list