From 3870eb0bd3c387307e293330e195d45dfc5551db Mon Sep 17 00:00:00 2001
From: Martin Teichmann <martin.teichmann@xfel.eu>
Date: Thu, 25 Feb 2021 13:34:10 +0000
Subject: [PATCH] factor out a non-fast ethercat

---
 ebpfcat/ebpfcat.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/ebpfcat/ebpfcat.py b/ebpfcat/ebpfcat.py
index f39a805..d15a982 100644
--- a/ebpfcat/ebpfcat.py
+++ b/ebpfcat/ebpfcat.py
@@ -256,14 +256,22 @@ class EtherXDP(XDP):
         e.exit(XDPExitCode.PASS)
 
 
-class FastEtherCat(EtherCat):
-    MAX_PROGS = 64
-
+class SimpleEtherCat(EtherCat):
     def __init__(self, network, terminals):
         super().__init__(network)
         self.terminals = terminals
         for t in terminals:
             t.ec = self
+
+    async def scan_bus(self):
+        await gather(*[t.initialize(-i, i + 1)
+                     for (i, t) in enumerate(self.terminals)])
+
+class FastEtherCat(SimpleEtherCat):
+    MAX_PROGS = 64
+
+    def __init__(self, network, terminals):
+        super().__init__(network, terminals)
         self.programs = create_map(MapType.PROG_ARRAY, 4, 4, self.MAX_PROGS)
         self.sync_groups = {}
 
@@ -276,10 +284,6 @@ class FastEtherCat(EtherCat):
         self.sync_groups[index] = sg
         return index
 
-    async def scan_bus(self):
-        await gather(*[t.initialize(-i, i + 1)
-                     for (i, t) in enumerate(self.terminals)])
-
     async def connect(self):
         await super().connect()
         self.ebpf = EtherXDP()
-- 
GitLab