Skip to content
Snippets Groups Projects
Commit 3870eb0b authored by Martin Teichmann's avatar Martin Teichmann
Browse files

factor out a non-fast ethercat

parent b6ce2856
No related branches found
No related tags found
No related merge requests found
...@@ -256,14 +256,22 @@ class EtherXDP(XDP): ...@@ -256,14 +256,22 @@ class EtherXDP(XDP):
e.exit(XDPExitCode.PASS) e.exit(XDPExitCode.PASS)
class FastEtherCat(EtherCat): class SimpleEtherCat(EtherCat):
MAX_PROGS = 64
def __init__(self, network, terminals): def __init__(self, network, terminals):
super().__init__(network) super().__init__(network)
self.terminals = terminals self.terminals = terminals
for t in terminals: for t in terminals:
t.ec = self 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.programs = create_map(MapType.PROG_ARRAY, 4, 4, self.MAX_PROGS)
self.sync_groups = {} self.sync_groups = {}
...@@ -276,10 +284,6 @@ class FastEtherCat(EtherCat): ...@@ -276,10 +284,6 @@ class FastEtherCat(EtherCat):
self.sync_groups[index] = sg self.sync_groups[index] = sg
return index 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): async def connect(self):
await super().connect() await super().connect()
self.ebpf = EtherXDP() self.ebpf = EtherXDP()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment