periodleft and delayleft
Run Simulator Tests on local RHEL9 / build (push) Failing after 3m13s
Build on RHEL9 docker image / build (push) Failing after 3m51s
Run Simulator Tests on local RHEL8 / build (push) Failing after 4m56s
Build on RHEL8 docker image / build (push) Failing after 5m12s

This commit is contained in:
2026-04-30 11:29:44 +02:00
parent 8dbe0a32a3
commit 259f9e9f90
4 changed files with 35 additions and 8 deletions
@@ -1143,6 +1143,7 @@ int getNumTransceiverSamples() { return ntSamples; }
int setExpTime(int64_t val, char *mess) {
setPatternWaitInterval(0, val);
// validate for tolerance
int64_t retval = 0;
if (getExpTime(&retval, mess) == FAIL) {
@@ -1236,14 +1237,27 @@ int64_t getNumTriggersLeft() {
return get64BitReg(CYCLES_LEFT_LSB_REG, CYCLES_LEFT_MSB_REG);
}
int64_t getDelayAfterTriggerLeft() {
return get64BitReg(DELAY_LEFT_LSB_REG, DELAY_LEFT_MSB_REG) /
(NS_TO_CLK_CYCLE * clkFrequency[SYNC_CLK]);
int getDelayAfterTriggerLeft(int64_t *retval, char *mess) {
if (clkFrequency[SYNC_CLK] == 0) {
sprintf(mess, "Cannot get delay after trigger left. Sync clock "
"frequency is 0.\n");
LOG(logERROR, (mess));
return FAIL;
}
uint64_t numClocks = get64BitReg(DELAY_LEFT_LSB_REG, DELAY_LEFT_MSB_REG);
*retval = clocks_to_ns(numClocks, clkFrequency[SYNC_CLK]);
return OK;
}
int64_t getPeriodLeft() {
return get64BitReg(PERIOD_LEFT_LSB_REG, PERIOD_LEFT_MSB_REG) /
(NS_TO_CLK_CYCLE * clkFrequency[SYNC_CLK]);
int getPeriodLeft(int64_t *retval, char *mess) {
if (clkFrequency[SYNC_CLK] == 0) {
sprintf(mess, "Cannot get period left. Sync clock frequency is 0.\n");
LOG(logERROR, (mess));
return FAIL;
}
uint64_t numClocks = get64BitReg(PERIOD_LEFT_LSB_REG, PERIOD_LEFT_MSB_REG);
*retval = clocks_to_ns(numClocks, clkFrequency[SYNC_CLK]);
return OK;
}
int64_t getFramesFromStart() {
@@ -113,8 +113,8 @@ int64_t getNumFramesLeft();
int64_t getNumTriggersLeft();
int setDelayAfterTrigger(int64_t val, char *mess);
int getDelayAfterTrigger(int64_t *retval, char *mess);
int64_t getDelayAfterTriggerLeft();
int64_t getPeriodLeft();
int getDelayAfterTriggerLeft(int64_t *retval, char *mess);
int getPeriodLeft(int64_t *retval, char *mess);
int64_t getFramesFromStart();
int64_t getActualTime();
int64_t getMeasurementTime();
@@ -2,6 +2,7 @@
// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "clogger.h"
#include "sls/md5.h"
#include <stdint.h> // int64_t
#include <stdio.h>
@@ -27,6 +28,10 @@ static inline uint64_t ns_to_clocks(uint64_t t, uint32_t freq_hz) {
return (t * (uint64_t)freq_hz + HALF_NS_PER_SEC) / NS_PER_SEC;
}
static inline uint64_t clocks_to_ns(uint64_t clocks, uint32_t freq_hz) {
if (freq_hz == 0) {
LOG(logERROR, ("Frequency is 0, cannot convert clocks to ns\n"));
return (uint64_t)-1;
}
return (clocks * (uint64_t)NS_PER_SEC + freq_hz / 2) / freq_hz;
}
@@ -2826,7 +2826,11 @@ int get_period_left(int file_des) {
functionNotImplemented();
#else
// get only
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
ret = getPeriodLeft(&retval, mess);
#else
retval = getPeriodLeft();
#endif
LOG(logDEBUG1, ("retval period left %lld ns\n", (long long int)retval));
#endif
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
@@ -2843,7 +2847,11 @@ int get_delay_after_trigger_left(int file_des) {
functionNotImplemented();
#else
// get only
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
ret = getDelayAfterTriggerLeft(&retval, mess);
#else
retval = getDelayAfterTriggerLeft();
#endif
LOG(logDEBUG1,
("retval delay after trigger left %lld ns\n", (long long int)retval));
#endif