From 7e7ff3e2f4979adab50bab965537420dcb67fef2 Mon Sep 17 00:00:00 2001
From: "ezekiel.dohmen" <ezekiel.dohmen@ligo.org>
Date: Thu, 25 Jul 2024 11:47:01 -0500
Subject: [PATCH] Adding xmit indicator and fixing builds with IPCs

---
 src/epics/util/lib/medmGenGdsTp.pm | 16 ++++++++++------
 src/fe/commData3.c                 |  7 +++----
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/epics/util/lib/medmGenGdsTp.pm b/src/epics/util/lib/medmGenGdsTp.pm
index a04db96be..3ed9d63d9 100644
--- a/src/epics/util/lib/medmGenGdsTp.pm
+++ b/src/epics/util/lib/medmGenGdsTp.pm
@@ -216,11 +216,6 @@ sub createGdsMedm
 	$xpos = 125; $ypos = 120; $width = 50; $height = 16;
 	$medmdata .= ("CDS::medmGen::medmGenTextDyn") -> ($xpos,$ypos,$width,$height,"ExtClk",$ecolors{green},"(A&255) == 0","$ifo\:FEC-$dcuid\_TIME_ERR");
 
-    if($iopModel == 1 && $::dolphin_time_xmit > 0 )
-    {
-        $xpos = 125; $ypos = 140; $width = 50; $height = 16;
-        $medmdata .= ("CDS::medmGen::medmGenText") -> ($xpos,$ypos,$width,$height,"timing xmit master",$ecolors{red});
-    }
 
 
 	# Following only for IOP
@@ -492,7 +487,16 @@ sub createGdsMedm
 			$bxpos = 340;
 			$bypos = 201;
 		}
-	}
+	} #For each DAC
+
+
+    if($iopModel == 1 && $::dolphin_time_xmit > 0 )
+    {
+        $xpos = 125; $ypos = 140; $width = 50; $height = 16;
+        $medmdata .= ("CDS::medmGen::medmGenText") -> ($xpos,$ypos,$width,$height,"Dolphin Timing",$ecolors{red});
+        $medmdata .= ("CDS::medmGen::medmGenText") -> ($xpos,$ypos+16,$width,$height,"Xmit Master",$ecolors{red});
+    }
+
 
 print OUTMEDM "$medmdata \n";
 close OUTMEDM;
diff --git a/src/fe/commData3.c b/src/fe/commData3.c
index 632daa344..60a0569f0 100644
--- a/src/fe/commData3.c
+++ b/src/fe/commData3.c
@@ -54,7 +54,6 @@
 #include "controller.h" //cdsPciModules, _shmipc_shm
 #include "drv/rts-logger.h"
 #include "util/timing.h"
-#include "modelRateInfo.h"
 
 #ifdef __KERNEL__
 #include <asm/cacheflush.h>
@@ -497,11 +496,11 @@ int commData3Receive(
     int temp_sleep_count=0;
 
     //g_max_cycle_time_us is always set by the controller before it is reset for the second
-    if ( g_max_cycle_time_us >= ((1.0/FE_RATE)*1000000)) { //Max is larger than cycle time (no headroom)
+    if ( g_max_cycle_time_us >= ((1.0/MODEL_RATE_HZ)*1000000)) { //Max is larger than cycle time (no headroom)
         max_time_to_wait_ns = 0;
     }
     else {
-        max_time_to_wait_ns = ((((1.0/FE_RATE)*1000000) - g_max_cycle_time_us) * 1000) * MULT_HEADROOM_TO_WAIT;
+        max_time_to_wait_ns = ((((1.0/MODEL_RATE_HZ)*1000000) - g_max_cycle_time_us) * 1000) * MULT_HEADROOM_TO_WAIT;
     }
     //Never wait longer than MAX_ABS_WAIT_TIME_NS
     if ( max_time_to_wait_ns > MAX_ABS_WAIT_TIME_NS) max_time_to_wait_ns = MAX_ABS_WAIT_TIME_NS;
@@ -619,4 +618,4 @@ void commData3GetStats( CDS_IPC_STATS_t * stats_ptr)
 {
     memcpy((void*)stats_ptr, &g_ipc_wait_time_stats, sizeof(*stats_ptr));
     memset(&g_ipc_wait_time_stats, 0, sizeof(g_ipc_wait_time_stats));
-}
\ No newline at end of file
+}
-- 
GitLab