From 2e9277daf213187854b72afa49cd83876609ec27 Mon Sep 17 00:00:00 2001
From: Bjoern Senfftleben <bjoern.senfftleben@xfel.eu>
Date: Sun, 9 Feb 2025 17:30:24 +0100
Subject: [PATCH] increase link speed

---
 src/tempus/Tempus.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/tempus/Tempus.py b/src/tempus/Tempus.py
index 990d3ea..82b5791 100644
--- a/src/tempus/Tempus.py
+++ b/src/tempus/Tempus.py
@@ -229,6 +229,8 @@ class Tempus(Device):
         try:
             multi_link = self.enableMultiLink
             if not multi_link:
+                link_speed = 1 # 1 -> 2.56Gbit / 2 -> 1.28 Gbit
+
                 await self.send_command("os.system('devmem2 0x80010004 w 0x2')")
                 await self.send_command("os.system('devmem2 0x80010004 w 0x0')")
                 await self.send_command("os.system('devmem2 0x80010004 w 0x2')")
@@ -240,7 +242,7 @@ class Tempus(Device):
 
                 link_result = await self.send_command(
                     f"os.system('{self.APP_DIR}/sc_set_gwt_link_up.py -i 0x0 "
-                    "-l 0x0 -s 0x2')", sleep_time=15)  # 0x2 -> 0x1 at the end would double the bandwidth per link to 2.56 Gbit/s instead of 1.28
+                    "-l 0x0 -s 0x{link_speed:.0f}')", sleep_time=15)  # 0x2 -> 0x1 at the end would double the bandwidth per link to 2.56 Gbit/s instead of 1.28
                 if "DOWN" in link_result:
                     self.LinkStateBottom1 = State.ERROR
                 elif "READY" in link_result:
@@ -250,7 +252,7 @@ class Tempus(Device):
 
                 link_result = await self.send_command(
                     f"os.system('{self.APP_DIR}/sc_set_gwt_link_up.py -i 0x1 "
-                    "-l 0x0 -s 0x2')", sleep_time=15)  # 0x2 -> 0x1 at the end would double the bandwidth per link to 2.56 Gbit/s instead of 1.28
+                    "-l 0x0 -s 0x{link_speed:.0f}')", sleep_time=15)  # 0x2 -> 0x1 at the end would double the bandwidth per link to 2.56 Gbit/s instead of 1.28
                 if "DOWN" in link_result:
                     self.LinkStateTop1 = State.ERROR
                 elif "READY" in link_result:
-- 
GitLab