diff --git a/slsDetectorGui/include/qDacWidget.h b/slsDetectorGui/include/qDacWidget.h
index 8925e1c32..ef2b7f85d 100644
--- a/slsDetectorGui/include/qDacWidget.h
+++ b/slsDetectorGui/include/qDacWidget.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/Detector.h"
#include "sls/sls_detector_defs.h"
diff --git a/slsDetectorGui/include/qDefs.h b/slsDetectorGui/include/qDefs.h
index 4364e3b3b..8ee853bae 100644
--- a/slsDetectorGui/include/qDefs.h
+++ b/slsDetectorGui/include/qDefs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/logger.h"
diff --git a/slsDetectorGui/include/qDetectorMain.h b/slsDetectorGui/include/qDetectorMain.h
index 92ae9b6cc..2d4b9ac38 100644
--- a/slsDetectorGui/include/qDetectorMain.h
+++ b/slsDetectorGui/include/qDetectorMain.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "qDefs.h"
#include "sls/Detector.h"
diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h
index 03277ff49..df96214bf 100644
--- a/slsDetectorGui/include/qDrawPlot.h
+++ b/slsDetectorGui/include/qDrawPlot.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "qDefs.h"
#include "sls/Detector.h"
diff --git a/slsDetectorGui/include/qTabAdvanced.h b/slsDetectorGui/include/qTabAdvanced.h
index 355beab05..074ab4131 100644
--- a/slsDetectorGui/include/qTabAdvanced.h
+++ b/slsDetectorGui/include/qTabAdvanced.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/Detector.h"
#include "ui_form_tab_advanced.h"
diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h
index 8f753a6db..bb1fbebe8 100644
--- a/slsDetectorGui/include/qTabDataOutput.h
+++ b/slsDetectorGui/include/qTabDataOutput.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/Detector.h"
#include "ui_form_tab_dataoutput.h"
diff --git a/slsDetectorGui/include/qTabDebugging.h b/slsDetectorGui/include/qTabDebugging.h
index 412046914..48cd85aae 100644
--- a/slsDetectorGui/include/qTabDebugging.h
+++ b/slsDetectorGui/include/qTabDebugging.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/Detector.h"
#include "ui_form_tab_debugging.h"
diff --git a/slsDetectorGui/include/qTabDeveloper.h b/slsDetectorGui/include/qTabDeveloper.h
index be3d25c4c..9dacf6442 100644
--- a/slsDetectorGui/include/qTabDeveloper.h
+++ b/slsDetectorGui/include/qTabDeveloper.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/Detector.h"
#include "sls/sls_detector_defs.h"
diff --git a/slsDetectorGui/include/qTabMeasurement.h b/slsDetectorGui/include/qTabMeasurement.h
index b1b1270a5..7b1f7d1aa 100644
--- a/slsDetectorGui/include/qTabMeasurement.h
+++ b/slsDetectorGui/include/qTabMeasurement.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/Detector.h"
#include "ui_form_tab_measurement.h"
diff --git a/slsDetectorGui/include/qTabMessages.h b/slsDetectorGui/include/qTabMessages.h
index 23f692478..98676fe24 100644
--- a/slsDetectorGui/include/qTabMessages.h
+++ b/slsDetectorGui/include/qTabMessages.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "ui_form_tab_messages.h"
diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h
index c146d07d9..073e3a7b3 100644
--- a/slsDetectorGui/include/qTabPlot.h
+++ b/slsDetectorGui/include/qTabPlot.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/Detector.h"
#include "ui_form_tab_plot.h"
diff --git a/slsDetectorGui/include/qTabSettings.h b/slsDetectorGui/include/qTabSettings.h
index d4ec2f73a..2a2a2c8af 100644
--- a/slsDetectorGui/include/qTabSettings.h
+++ b/slsDetectorGui/include/qTabSettings.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/Detector.h"
#include "ui_form_tab_settings.h"
@@ -64,14 +66,7 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
NUMSETTINGS
};
- enum {
- DYNAMIC,
- FORCE_SWITCH_G1,
- FORCE_SWITCH_G2,
- FIX_G1,
- FIX_G2,
- FIX_G0
- };
+ enum { DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 };
bool isVisibleFixG0{false};
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
index da0dac1d1..e3cbb4e21 100644
--- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
+++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef SLSQT1DPLOT_H
#define SLSQT1DPLOT_H
diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h
index 5e9b8e079..c87a37931 100644
--- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h
+++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef SLSQT1DZOOMER_H
#define SLSQT1DZOOMER_H
diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h
index eafb68eba..e19c1859b 100644
--- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h
+++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef SLSQT2DHIST_H
#define SLSQT2DHIST_H
diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h
index 25342f8a7..b0067bc98 100644
--- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h
+++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "SlsQt2DHist.h"
#include "SlsQt2DZoomer.h"
diff --git a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h
index a9592c550..227ec0e52 100644
--- a/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h
+++ b/slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef SLSQT2DZOOMER_H
#define SLSQT2DZOOMER_H
#include "SlsQt2DHist.h"
diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cpp b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cpp
index 6c04f0124..cf3450a0d 100644
--- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cpp
+++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
/* TODO! short description */
#include "SlsQt1DPlot.h"
diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cpp b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cpp
index 3c0bfa09f..85813fc45 100644
--- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cpp
+++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
/* TODO! short description */
#include "SlsQt1DZoomer.h"
#include "SlsQt1DPlot.h"
diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cpp b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cpp
index ade86d47c..a6dbf0548 100644
--- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cpp
+++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
/* TODO! short description */
#include "SlsQt2DHist.h"
#include "sls/ansi.h"
diff --git a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cpp b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cpp
index e00c93743..4a686e617 100644
--- a/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cpp
+++ b/slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "SlsQt2DPlot.h"
// #include "sls/ansi.h"
diff --git a/slsDetectorGui/src/qCloneWidget.cpp b/slsDetectorGui/src/qCloneWidget.cpp
index 42b80439e..4d8c4210f 100644
--- a/slsDetectorGui/src/qCloneWidget.cpp
+++ b/slsDetectorGui/src/qCloneWidget.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qCloneWidget.h"
#include "SlsQt1DPlot.h"
#include "SlsQt2DPlot.h"
diff --git a/slsDetectorGui/src/qDacWidget.cpp b/slsDetectorGui/src/qDacWidget.cpp
index 5db875e4f..7fb53b46b 100644
--- a/slsDetectorGui/src/qDacWidget.cpp
+++ b/slsDetectorGui/src/qDacWidget.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qDacWidget.h"
#include "qDefs.h"
diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp
index 634def39e..7d136aaba 100644
--- a/slsDetectorGui/src/qDetectorMain.cpp
+++ b/slsDetectorGui/src/qDetectorMain.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qDetectorMain.h"
#include "qDefs.h"
#include "qDrawPlot.h"
@@ -439,34 +441,43 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, "
"Gotthard, Gotthard2 and Moench detectors";
- std::string guiVersion = std::to_string(APIGUI);
+ std::string guiVersion = sls::ToStringHex(APIGUI);
std::string clientVersion = "unknown";
try {
- clientVersion = std::to_string(det->getClientVersion());
+ clientVersion = sls::ToStringHex(det->getClientVersion());
}
CATCH_DISPLAY("Could not get client version.",
"qDetectorMain::ExecuteHelp")
- qDefs::Message(qDefs::INFORMATION,
- ""
- "SLS Detector GUI version: " +
- guiVersion +
- "
"
- "SLS Detector Client version: " +
- clientVersion +
- "
"
- "Common GUI to control the SLS Detectors: "
- "Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and "
- "Moench.
"
- "It can be operated in parallel with the command "
- "line interface:
"
- "sls_detector_put,
sls_detector_get,
sls_"
- "detector_acquire and
sls_detector_help.
"
- "Please report bugs to:
"
- "Dhanya.Thattil@psi.ch,
"
- "Erik.Froejdh@psi.ch or
"
- "Anna.Bergamaschi@psi.ch.<\\p>",
- "qDetectorMain::ExecuteHelp");
+ qDefs::Message(
+ qDefs::INFORMATION,
+ "
"
+
+ "SLS Detector GUI version: " +
+ guiVersion +
+ "
SLS Detector Client version: " + clientVersion +
+ "
"
+
+ "Common GUI to control the SLS Detectors: "
+ "Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and "
+ "Moench.
"
+
+ "It can be operated in parallel with the command "
+ "line interface: sls_detector_put, sls_detector_get, "
+ "sls_detector_acquire and sls_detector_help.
"
+
+ "Support:
"
+ "Dhanya.Thattil@psi.ch
"
+ "Erik.Froejdh@psi.ch.
"
+
+ "
slsDetectorGui Copyright (C) 2021 Contributors to SLS "
+ "Detector Package
"
+
+ "See COPYING in root folder for Licensing details:
"
+ "LGPL-3.0-or-other"
+
+ "<\\p>",
+ "qDetectorMain::ExecuteHelp");
}
}
diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp
index c10646a8b..40edc1538 100644
--- a/slsDetectorGui/src/qDrawPlot.cpp
+++ b/slsDetectorGui/src/qDrawPlot.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qDrawPlot.h"
#include "SlsQt1DPlot.h"
#include "SlsQt2DPlot.h"
diff --git a/slsDetectorGui/src/qTabAdvanced.cpp b/slsDetectorGui/src/qTabAdvanced.cpp
index afbe147e2..35792344b 100644
--- a/slsDetectorGui/src/qTabAdvanced.cpp
+++ b/slsDetectorGui/src/qTabAdvanced.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qTabAdvanced.h"
#include "qDefs.h"
#include "qDrawPlot.h"
diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp
index f750b7cba..171ec7f3e 100644
--- a/slsDetectorGui/src/qTabDataOutput.cpp
+++ b/slsDetectorGui/src/qTabDataOutput.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qTabDataOutput.h"
#include "qDefs.h"
@@ -369,27 +371,27 @@ void qTabDataOutput::SetRateCorrection() {
}
void qTabDataOutput::GetSpeed() {
- LOG(logDEBUG) << "Getting Speed";
+ LOG(logDEBUG) << "Getting Readout Speed";
disconnect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSpeed(int)));
try {
- auto retval =
- det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
+ auto retval = det->getReadoutSpeed().tsquash(
+ "Readout Speed is inconsistent for all detectors.");
comboClkDivider->setCurrentIndex(static_cast(retval));
}
- CATCH_DISPLAY("Could not get speed.", "qTabDataOutput::GetSpeed")
+ CATCH_DISPLAY("Could not get readout speed.", "qTabDataOutput::GetSpeed")
connect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetSpeed(int)));
}
void qTabDataOutput::SetSpeed(int speed) {
- LOG(logINFO) << "Setting Speed to "
+ LOG(logINFO) << "Setting Readout Speed to "
<< comboClkDivider->currentText().toAscii().data();
try {
- det->setSpeed(static_cast(speed));
+ det->setReadoutSpeed(static_cast(speed));
}
- CATCH_HANDLE("Could not set speed.", "qTabDataOutput::SetSpeed", this,
- &qTabDataOutput::GetSpeed)
+ CATCH_HANDLE("Could not set readout speed.", "qTabDataOutput::SetSpeed",
+ this, &qTabDataOutput::GetSpeed)
}
void qTabDataOutput::GetParallel() {
diff --git a/slsDetectorGui/src/qTabDebugging.cpp b/slsDetectorGui/src/qTabDebugging.cpp
index 3e6497710..b995ba65a 100644
--- a/slsDetectorGui/src/qTabDebugging.cpp
+++ b/slsDetectorGui/src/qTabDebugging.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qTabDebugging.h"
#include "qDefs.h"
#include "sls/ToString.h"
diff --git a/slsDetectorGui/src/qTabDeveloper.cpp b/slsDetectorGui/src/qTabDeveloper.cpp
index 8d0084719..0c4a751e3 100644
--- a/slsDetectorGui/src/qTabDeveloper.cpp
+++ b/slsDetectorGui/src/qTabDeveloper.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qTabDeveloper.h"
#include "qDacWidget.h"
#include "qDefs.h"
diff --git a/slsDetectorGui/src/qTabMeasurement.cpp b/slsDetectorGui/src/qTabMeasurement.cpp
index 19aa42bf7..93e4e4409 100644
--- a/slsDetectorGui/src/qTabMeasurement.cpp
+++ b/slsDetectorGui/src/qTabMeasurement.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qTabMeasurement.h"
#include "qDefs.h"
#include "qDrawPlot.h"
diff --git a/slsDetectorGui/src/qTabMessages.cpp b/slsDetectorGui/src/qTabMessages.cpp
index 98a195989..8f87d02d7 100644
--- a/slsDetectorGui/src/qTabMessages.cpp
+++ b/slsDetectorGui/src/qTabMessages.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qTabMessages.h"
#include "qDefs.h"
diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp
index 1f1e77a4e..c4954b234 100644
--- a/slsDetectorGui/src/qTabPlot.cpp
+++ b/slsDetectorGui/src/qTabPlot.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qTabPlot.h"
#include "qDefs.h"
#include "qDrawPlot.h"
diff --git a/slsDetectorGui/src/qTabSettings.cpp b/slsDetectorGui/src/qTabSettings.cpp
index 158cd6de1..dcee0a450 100644
--- a/slsDetectorGui/src/qTabSettings.cpp
+++ b/slsDetectorGui/src/qTabSettings.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "qTabSettings.h"
#include "qDefs.h"
#include "sls/ToString.h"
@@ -126,8 +128,8 @@ void qTabSettings::SetupDetectorSettings() {
item[(int)it]->setEnabled(true);
}
}
- CATCH_DISPLAY(std::string("Could not setup settings"),
- "qTabSettings::SetupDetectorSettings")
+ CATCH_DISPLAY(std::string("Could not setup settings"),
+ "qTabSettings::SetupDetectorSettings")
}
}
diff --git a/slsDetectorServers/CMakeLists.txt b/slsDetectorServers/CMakeLists.txt
index af46daa94..2bb9386b0 100644
--- a/slsDetectorServers/CMakeLists.txt
+++ b/slsDetectorServers/CMakeLists.txt
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
diff --git a/slsDetectorServers/compileAllServers.sh b/slsDetectorServers/compileAllServers.sh
index b72e980bd..3158da364 100644
--- a/slsDetectorServers/compileAllServers.sh
+++ b/slsDetectorServers/compileAllServers.sh
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
if [ $# -eq 0 ]; then
declare -a det=("ctbDetectorServer"
"gotthardDetectorServer"
diff --git a/slsDetectorServers/compileEigerServer.sh b/slsDetectorServers/compileEigerServer.sh
index aa3348cf5..94e3343ca 100644
--- a/slsDetectorServers/compileEigerServer.sh
+++ b/slsDetectorServers/compileEigerServer.sh
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
declare -a det=("eigerDetectorServer")
declare -a deterror=("OK" "OK" "OK" "OK")
diff --git a/slsDetectorServers/ctbDetectorServer/CMakeLists.txt b/slsDetectorServers/ctbDetectorServer/CMakeLists.txt
index fab32df54..181600f44 100644
--- a/slsDetectorServers/ctbDetectorServer/CMakeLists.txt
+++ b/slsDetectorServers/ctbDetectorServer/CMakeLists.txt
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
add_executable(ctbDetectorServer_virtual
slsDetectorFunctionList.c
../slsDetectorServer/src/slsDetectorServer.c
diff --git a/slsDetectorServers/ctbDetectorServer/Makefile b/slsDetectorServers/ctbDetectorServer/Makefile
index fea8d8db6..56b3b271b 100755
--- a/slsDetectorServers/ctbDetectorServer/Makefile
+++ b/slsDetectorServers/ctbDetectorServer/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
current_dir = $(shell pwd)
main_inc = ../slsDetectorServer/include/
main_src = ../slsDetectorServer/src/
diff --git a/slsDetectorServers/ctbDetectorServer/RegisterDefs.h b/slsDetectorServers/ctbDetectorServer/RegisterDefs.h
index 30e9f0649..ce7fa1337 100644
--- a/slsDetectorServers/ctbDetectorServer/RegisterDefs.h
+++ b/slsDetectorServers/ctbDetectorServer/RegisterDefs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
/* Definitions for FPGA */
diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer
index f5ef865e4..bf2e9f401 100755
Binary files a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServer_developer differ
diff --git a/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv6.0.0-rc1 b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv6.0.0-rc1
new file mode 100755
index 000000000..ba9bc1ef8
Binary files /dev/null and b/slsDetectorServers/ctbDetectorServer/bin/ctbDetectorServerv6.0.0-rc1 differ
diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c
index e7f57a896..b1f8f51bb 100644
--- a/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c
+++ b/slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "slsDetectorFunctionList.h"
#include "clogger.h"
#include "sharedMemory.h"
diff --git a/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h
index a878e5d22..93d7569cb 100644
--- a/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h
+++ b/slsDetectorServers/ctbDetectorServer/slsDetectorServer_defs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "RegisterDefs.h"
#include "sls/sls_detector_defs.h"
@@ -5,6 +7,8 @@
#define MIN_REQRD_VRSN_T_RD_API 0x181130
#define REQRD_FRMWR_VRSN 0x201005
+#define LINKED_SERVER_NAME "ctbDetectorServer"
+
#define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000)
/* Struct Definitions */
diff --git a/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c b/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c
index 4a79ae522..d5651ec7b 100644
--- a/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c
+++ b/slsDetectorServers/eigerDetectorServer/9mhvserial_bf.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "sls/ansi.h"
#include
diff --git a/slsDetectorServers/eigerDetectorServer/Beb.c b/slsDetectorServers/eigerDetectorServer/Beb.c
index 629d0ba44..57fcd5a9a 100644
--- a/slsDetectorServers/eigerDetectorServer/Beb.c
+++ b/slsDetectorServers/eigerDetectorServer/Beb.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "Beb.h"
#include "FebRegisterDefs.h"
#include "clogger.h"
@@ -8,6 +10,8 @@
#include
#include
+extern int isControlServer;
+
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
struct LocalLinkInterface ll_beb_local, *ll_beb;
@@ -42,7 +46,6 @@ int Beb_deactivated_left_datastream = 1;
int Beb_deactivated_right_datastream = 1;
int Beb_deactivated_num_destinations = 1;
-
void Beb_Beb() {
Beb_send_ndata = 0;
Beb_send_buffer_size = 1026;
@@ -85,7 +88,9 @@ void Beb_Beb() {
void Beb_ClearHeaderData(int ten_gig) {
for (int i = 0; i < MAX_UDP_DESTINATION; ++i) {
if (!Beb_SetUpUDPHeader(i, ten_gig, 0, 0, 0, 0, 0, 0)) {
- LOG(logERROR, ("Could not clear header data for entry %d (tengiga:%d)\n", i, ten_gig));
+ LOG(logERROR,
+ ("Could not clear header data for entry %d (tengiga:%d)\n", i,
+ ten_gig));
}
}
}
@@ -97,6 +102,9 @@ int Beb_SetUpUDPHeader(unsigned int header_number, int ten_gig,
if (!Beb_activated)
return 1;
+ if (!isControlServer)
+ return 1;
+
u_int32_t bram_phy_addr;
u_int32_t *csp0base = 0;
if (ten_gig)
@@ -104,7 +112,8 @@ int Beb_SetUpUDPHeader(unsigned int header_number, int ten_gig,
else
bram_phy_addr = 0xC6001000;
- if (!Beb_SetHeaderData(src_mac, src_ip, src_port, dst_mac, dst_ip, dst_port))
+ if (!Beb_SetHeaderData(src_mac, src_ip, src_port, dst_mac, dst_ip,
+ dst_port))
return 0;
int fd = Beb_open(&csp0base, bram_phy_addr);
@@ -485,7 +494,7 @@ int Beb_SetDataStream(enum portPosition port, int enable) {
: XPAR_GPIO_RGHT_STRM_DSBL_MSK);
u_int32_t value = Beb_Read32(csp0base, reg);
- // disabling in firmware
+ // disabling in firmware
if (!enable)
value |= mask;
else
@@ -867,11 +876,12 @@ int Beb_StopAcquisition() {
return 1;
}
-int Beb_RequestNImages(int ten_gig, unsigned int nimages, int test_just_send_out_packets_no_wait) {
+int Beb_RequestNImages(int ten_gig, unsigned int nimages,
+ int test_just_send_out_packets_no_wait) {
if (!Beb_activated)
return 1;
- unsigned int maxnl = MAX_ROWS_PER_READOUT;
+ unsigned int maxnl = MAX_ROWS_PER_READOUT;
unsigned int maxnp = (ten_gig ? 4 : 16) * Beb_bit_mode;
unsigned int nl = Beb_readNRows;
unsigned int npackets = (nl * maxnp) / maxnl;
@@ -891,8 +901,8 @@ int Beb_RequestNImages(int ten_gig, unsigned int nimages, int test_just_send_out
LOG(logINFO, ("ten_gig:%d, npackets:%d, "
"Beb_bit_mode:%d, header_size:%d, nimages:%d, "
"test_just_send_out_packets_no_wait:%d\n",
- ten_gig, npackets, Beb_bit_mode,
- header_size, nimages, test_just_send_out_packets_no_wait));
+ ten_gig, npackets, Beb_bit_mode, header_size, nimages,
+ test_just_send_out_packets_no_wait));
u_int32_t right_port_value = 0x2000;
u_int32_t *csp0base = 0;
diff --git a/slsDetectorServers/eigerDetectorServer/Beb.h b/slsDetectorServers/eigerDetectorServer/Beb.h
index c4449b540..a238c1529 100644
--- a/slsDetectorServers/eigerDetectorServer/Beb.h
+++ b/slsDetectorServers/eigerDetectorServer/Beb.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "LocalLinkInterface.h"
diff --git a/slsDetectorServers/eigerDetectorServer/CMakeLists.txt b/slsDetectorServers/eigerDetectorServer/CMakeLists.txt
index 64f1635e1..ae8b9b0ea 100644
--- a/slsDetectorServers/eigerDetectorServer/CMakeLists.txt
+++ b/slsDetectorServers/eigerDetectorServer/CMakeLists.txt
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
set(src
slsDetectorFunctionList.c
../slsDetectorServer/src/slsDetectorServer.c
diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.c b/slsDetectorServers/eigerDetectorServer/FebControl.c
index 6ca0b85ae..27d98a30a 100644
--- a/slsDetectorServers/eigerDetectorServer/FebControl.c
+++ b/slsDetectorServers/eigerDetectorServer/FebControl.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "FebControl.h"
#include "Beb.h"
#include "FebRegisterDefs.h"
@@ -1141,7 +1143,8 @@ int Feb_Control_SoftwareTrigger(int block) {
// end of acquisition (cannot monitor readyForTrigger)
int status = Feb_Control_AcquisitionInProgress();
if (status == STATUS_ERROR) {
- LOG(logERROR, ("Status: ERROR reading DAQ status register\n"));
+ LOG(logERROR,
+ ("Status: ERROR reading DAQ status register\n"));
return 0;
} else if (status == STATUS_IDLE) {
break;
@@ -1156,8 +1159,10 @@ int Feb_Control_SoftwareTrigger(int block) {
}
LOG(logDEBUG2, ("Done waiting (wait for trigger)!\n"));
}
- LOG(logINFO, ("%s Software Trigger %s\n", (block ? "Blocking" : "Non blocking"), (block ? "Acquired" : "Sent")));
- fflush(stdout);
+ LOG(logINFO,
+ ("%s Software Trigger %s\n", (block ? "Blocking" : "Non blocking"),
+ (block ? "Acquired" : "Sent")));
+ fflush(stdout);
}
return 1;
diff --git a/slsDetectorServers/eigerDetectorServer/FebControl.h b/slsDetectorServers/eigerDetectorServer/FebControl.h
index d600a6ca8..7ede407ad 100644
--- a/slsDetectorServers/eigerDetectorServer/FebControl.h
+++ b/slsDetectorServers/eigerDetectorServer/FebControl.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "FebInterface.h"
#include "slsDetectorServer_defs.h"
diff --git a/slsDetectorServers/eigerDetectorServer/FebInterface.c b/slsDetectorServers/eigerDetectorServer/FebInterface.c
index 69042ce41..c93aa6a44 100644
--- a/slsDetectorServers/eigerDetectorServer/FebInterface.c
+++ b/slsDetectorServers/eigerDetectorServer/FebInterface.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "FebInterface.h"
#include "LocalLinkInterface.h"
#include "clogger.h"
diff --git a/slsDetectorServers/eigerDetectorServer/FebInterface.h b/slsDetectorServers/eigerDetectorServer/FebInterface.h
index e89ff498d..afff53a87 100644
--- a/slsDetectorServers/eigerDetectorServer/FebInterface.h
+++ b/slsDetectorServers/eigerDetectorServer/FebInterface.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
int Feb_Interface_WriteTo(unsigned int ch);
diff --git a/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h b/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h
index 643463858..db2627181 100644
--- a/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h
+++ b/slsDetectorServers/eigerDetectorServer/FebRegisterDefs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
// daq register definitions
#define DAQ_REG_CTRL 1
@@ -13,7 +15,7 @@
#define DAQ_REG_EXPOSURE_REPEAT_TIMER 5 // == (31 downto 3) * 10^(2 downto 0)
#define DAQ_REG_SUBFRAME_EXPOSURES 6
#define DAQ_REG_SUBFRAME_PERIOD 7 // also pg and fifo status register
-#define DAQ_REG_READ_N_ROWS 8
+#define DAQ_REG_READ_N_ROWS 8
#define DAQ_REG_HRDWRE 12
// clang-format off
diff --git a/slsDetectorServers/eigerDetectorServer/HardwareIO.c b/slsDetectorServers/eigerDetectorServer/HardwareIO.c
index e6487af4a..7e783d5d2 100644
--- a/slsDetectorServers/eigerDetectorServer/HardwareIO.c
+++ b/slsDetectorServers/eigerDetectorServer/HardwareIO.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "HardwareIO.h"
xfs_u8 HWIO_xfs_in8(xfs_u32 InAddress) {
diff --git a/slsDetectorServers/eigerDetectorServer/HardwareIO.h b/slsDetectorServers/eigerDetectorServer/HardwareIO.h
index dd2d0c73d..3e21ddc8b 100644
--- a/slsDetectorServers/eigerDetectorServer/HardwareIO.h
+++ b/slsDetectorServers/eigerDetectorServer/HardwareIO.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
// Class initially from Gerd and was called mmap_test.c
#pragma once
diff --git a/slsDetectorServers/eigerDetectorServer/HardwareMMappingDefs.h b/slsDetectorServers/eigerDetectorServer/HardwareMMappingDefs.h
index f2523f9a2..e8a99aac6 100644
--- a/slsDetectorServers/eigerDetectorServer/HardwareMMappingDefs.h
+++ b/slsDetectorServers/eigerDetectorServer/HardwareMMappingDefs.h
@@ -1,4 +1,5 @@
-
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
// from Gerd and was called mmap_test.h
diff --git a/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c b/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c
index 1c7dace24..c9252cf55 100644
--- a/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c
+++ b/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "LocalLinkInterface.h"
#include "HardwareMMappingDefs.h"
#include "clogger.h"
diff --git a/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.h b/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.h
index 4dfcbfa6c..ec587297b 100644
--- a/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.h
+++ b/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "HardwareIO.h"
diff --git a/slsDetectorServers/eigerDetectorServer/Makefile b/slsDetectorServers/eigerDetectorServer/Makefile
index 5f1d61d2d..c242d3bb1 100755
--- a/slsDetectorServers/eigerDetectorServer/Makefile
+++ b/slsDetectorServers/eigerDetectorServer/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
current_dir = $(shell pwd)
main_inc = ../slsDetectorServer/include/
main_src = ../slsDetectorServer/src/
diff --git a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer
index ed694dfd8..b76382caa 100755
Binary files a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer and b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServer_developer differ
diff --git a/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv6.0.0-rc2 b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv6.0.0-rc2
new file mode 100755
index 000000000..5f5d1db5e
Binary files /dev/null and b/slsDetectorServers/eigerDetectorServer/bin/eigerDetectorServerv6.0.0-rc2 differ
diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c
index eb44e5aaa..3e1ff4ef3 100644
--- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c
+++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "slsDetectorFunctionList.h"
#include "clogger.h"
#include "common.h"
@@ -690,7 +692,7 @@ void setupDetector() {
eiger_photonenergy = DEFAULT_PHOTON_ENERGY;
setParallelMode(DEFAULT_PARALLEL_MODE);
setOverFlowMode(DEFAULT_READOUT_OVERFLOW32_MODE);
- setClockDivider(RUN_CLK, DEFAULT_CLK_SPEED); // clk_devider,half speed
+ setReadoutSpeed(DEFAULT_CLK_SPEED);
setIODelay(DEFAULT_IO_DELAY);
setTiming(DEFAULT_TIMING_MODE);
setNextFrameNumber(DEFAULT_STARTING_FRAME_NUMBER);
@@ -1542,13 +1544,13 @@ int configureMAC() {
LOG(logINFOBLUE, ("\tEntry %d\n", iRxEntry));
LOG(logINFO,
("\tSource IP : %s\n"
- "\tSource MAC : %s\n"
- "\tSource Port : %d\n"
- "\tDest IP : %s\n"
- "\tDest MAC : %s\n"
- "\tDest Port : %d\n"
- "\tDest Port2 : %d\n",
- src_ip, src_mac, srcport, dst_ip, dst_mac, dstport, dstport2));
+ "\tSource MAC : %s\n"
+ "\tSource Port : %d\n"
+ "\tDest IP : %s\n"
+ "\tDest MAC : %s\n"
+ "\tDest Port : %d\n"
+ "\tDest Port2 : %d\n",
+ src_ip, src_mac, srcport, dst_ip, dst_mac, dstport, dstport2));
}
#ifdef VIRTUAL
@@ -1712,11 +1714,7 @@ int enableTenGigabitEthernet(int val) {
}
/* eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter */
-int setClockDivider(enum CLKINDEX ind, int val) {
- if (ind != RUN_CLK) {
- LOG(logERROR, ("Unknown clock index: %d\n", ind));
- return FAIL;
- }
+int setReadoutSpeed(int val) {
if (val >= 0) {
LOG(logINFO, ("Setting Read out Speed: %d\n", val));
#ifndef VIRTUAL
@@ -1732,12 +1730,9 @@ int setClockDivider(enum CLKINDEX ind, int val) {
return OK;
}
-int getClockDivider(enum CLKINDEX ind) {
- if (ind != RUN_CLK) {
- LOG(logERROR, ("Unknown clock index: %d\n", ind));
- return FAIL;
- }
- return eiger_readoutspeed;
+int getReadoutSpeed(int *retval) {
+ *retval = eiger_readoutspeed;
+ return OK;
}
int setIODelay(int val) {
@@ -2047,17 +2042,17 @@ int setAllTrimbits(int val) {
}
int getAllTrimbits() {
- int value = *((detectorModules->chanregs));
if (detectorModules) {
+ int value = (*((detectorModules->chanregs)));
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
if (*((detectorModules->chanregs) + ichan) != value) {
- value = -1;
- break;
+ return -1;
}
}
+ LOG(logINFO, ("Value of all Trimbits: %d\n", value));
+ return value;
}
- LOG(logINFO, ("Value of all Trimbits: %d\n", value));
- return value;
+ return -1;
}
int getBebFPGATemp() {
@@ -2316,14 +2311,11 @@ void *start_timer(void *arg) {
int readNRows = getReadNRows();
if (readNRows == -1) {
- LOG(logERROR,
- ("readNRows is -1. Assuming no readNRows.\n"));
+ LOG(logERROR, ("readNRows is -1. Assuming no readNRows.\n"));
readNRows = MAX_ROWS_PER_READOUT;
}
const int maxRows = MAX_ROWS_PER_READOUT;
- const int packetsPerFrame =
- (maxPacketsPerFrame * readNRows) / maxRows;
-
+ const int packetsPerFrame = (maxPacketsPerFrame * readNRows) / maxRows;
LOG(logDEBUG1,
(" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
@@ -2363,19 +2355,16 @@ void *start_timer(void *arg) {
break;
case 16:
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
- eiger_virtual_test_mode ? 0xFFE
- : (uint16_t)pixelVal;
+ eiger_virtual_test_mode ? 0xFFE : (uint16_t)pixelVal;
break;
case 32:
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
- eiger_virtual_test_mode ? 0xFFFFFE
- : (uint32_t)pixelVal;
+ eiger_virtual_test_mode ? 0xFFFFFE : (uint32_t)pixelVal;
break;
default:
break;
}
}
-
}
// Send data
@@ -2409,7 +2398,6 @@ void *start_timer(void *arg) {
const int startval = 0;
const int endval = startval + packetsPerFrame - 1;
-
// set header
char packetData[packetsize];
memset(packetData, 0, packetsize);
@@ -2471,18 +2459,21 @@ void *start_timer(void *arg) {
}
}
}
- if (eiger_virtual_left_datastream && i >= startval && i <= endval) {
+ if (eiger_virtual_left_datastream && i >= startval &&
+ i <= endval) {
usleep(eiger_virtual_transmission_delay_left);
sendUDPPacket(iRxEntry, 0, packetData, packetsize);
LOG(logDEBUG1, ("Sent left packet: %d\n", i));
}
- if (eiger_virtual_right_datastream && i >= startval && i <= endval) {
+ if (eiger_virtual_right_datastream && i >= startval &&
+ i <= endval) {
usleep(eiger_virtual_transmission_delay_right);
sendUDPPacket(iRxEntry, 1, packetData2, packetsize);
LOG(logDEBUG1, ("Sent right packet: %d\n", i));
}
}
- LOG(logINFO, ("Sent frame %d [#%ld] to E%d\n", iframes, frameNr + iframes, iRxEntry));
+ LOG(logINFO, ("Sent frame %d [#%ld] to E%d\n", iframes,
+ frameNr + iframes, iRxEntry));
clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
(end.tv_nsec - begin.tv_nsec));
diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h
index 125891d14..3f0e5a288 100644
--- a/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h
+++ b/slsDetectorServers/eigerDetectorServer/slsDetectorServer_defs.h
@@ -1,7 +1,11 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/sls_detector_defs.h"
-#define REQUIRED_FIRMWARE_VERSION (27)
+#define LINKED_SERVER_NAME "eigerDetectorServer"
+
+#define REQUIRED_FIRMWARE_VERSION (29)
// virtual ones renamed for consistency
// real ones keep previous name for compatibility (already in production)
#ifdef VIRTUAL
@@ -9,8 +13,8 @@
#else
#define ID_FILE "detid.txt"
#endif
-#define CONFIG_FILE ("config_eiger.txt")
-#define WAIT_STOP_SERVER_START (1 * 1000 * 1000)
+#define CONFIG_FILE ("config_eiger.txt")
+#define WAIT_STOP_SERVER_START (1 * 1000 * 1000)
#define STATUS_IDLE 0
#define STATUS_RUNNING 1
diff --git a/slsDetectorServers/eigerDetectorServer/xfs_types.h b/slsDetectorServers/eigerDetectorServer/xfs_types.h
index 3c7d6216c..1c998bdc4 100644
--- a/slsDetectorServers/eigerDetectorServer/xfs_types.h
+++ b/slsDetectorServers/eigerDetectorServer/xfs_types.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
//#include "types.h"
diff --git a/slsDetectorServers/eigerDetectorServer/xparameters.h b/slsDetectorServers/eigerDetectorServer/xparameters.h
index d293257d2..4b3bf1312 100644
--- a/slsDetectorServers/eigerDetectorServer/xparameters.h
+++ b/slsDetectorServers/eigerDetectorServer/xparameters.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
/* ONLY THOSE ARE USED IN THIS SOFTWARE. If one of those is modified in xilinx
compilation, this file should be replaced with updated values
XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR
diff --git a/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt b/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt
index f1399bf9c..dbe403fd3 100644
--- a/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt
+++ b/slsDetectorServers/gotthard2DetectorServer/CMakeLists.txt
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
add_executable(gotthard2DetectorServer_virtual
slsDetectorFunctionList.c
../slsDetectorServer/src/slsDetectorServer.c
diff --git a/slsDetectorServers/gotthard2DetectorServer/Makefile b/slsDetectorServers/gotthard2DetectorServer/Makefile
index 481827eab..23ea50584 100755
--- a/slsDetectorServers/gotthard2DetectorServer/Makefile
+++ b/slsDetectorServers/gotthard2DetectorServer/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
current_dir = $(shell pwd)
main_inc = ../slsDetectorServer/include/
main_src = ../slsDetectorServer/src/
diff --git a/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h b/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h
index cb1ac8428..a5a1fb87a 100644
--- a/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h
+++ b/slsDetectorServers/gotthard2DetectorServer/RegisterDefs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
// clang-format off
#define REG_OFFSET (4)
diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer
index 44269428c..a010150dc 100755
Binary files a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServer_developer differ
diff --git a/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv6.0.0-rc1 b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv6.0.0-rc1
new file mode 100755
index 000000000..9511bbb65
Binary files /dev/null and b/slsDetectorServers/gotthard2DetectorServer/bin/gotthard2DetectorServerv6.0.0-rc1 differ
diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c
index 9d7fd73bb..a9ae54ae6 100644
--- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c
+++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorFunctionList.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "slsDetectorFunctionList.h"
#include "ALTERA_PLL_CYCLONE10.h"
#include "ASIC_Driver.h"
@@ -294,7 +296,8 @@ int getModuleId(int *ret, char *mess) {
void setModuleId(int modid) {
LOG(logINFOBLUE, ("Setting module id in fpga: %d\n", modid))
bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) & ~MOD_ID_MSK);
- bus_w(MOD_ID_REG, bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
+ bus_w(MOD_ID_REG,
+ bus_r(MOD_ID_REG) | ((modid << MOD_ID_OFST) & MOD_ID_MSK));
}
u_int64_t getDetectorMAC() {
@@ -506,6 +509,7 @@ void setupDetector() {
setCurrentSource(DEFAULT_CURRENT_SOURCE);
setVetoAlgorithm(DEFAULT_ALGORITHM, LOW_LATENCY_LINK);
setVetoAlgorithm(DEFAULT_ALGORITHM, ETHERNET_10GB);
+ setReadoutSpeed(DEFAULT_READOUT_SPEED);
}
void setASICDefaults() {
@@ -1912,23 +1916,21 @@ int checkDetectorType() {
int type = atoi(buffer);
if (type > TYPE_NO_MODULE_STARTING_VAL) {
LOG(logERROR,
- ("No Module attached! Expected %d, %d or %d for Gotthard2, got %d\n",
- TYPE_GOTTHARD2_MODULE_VAL,
- TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL,
- TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL,
- type));
+ ("No Module attached! Expected %d, %d or %d for Gotthard2, got "
+ "%d\n",
+ TYPE_GOTTHARD2_MODULE_VAL, TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL,
+ TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL, type));
return -2;
}
if ((abs(type - TYPE_GOTTHARD2_MODULE_VAL) > TYPE_TOLERANCE) &&
- (abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) > TYPE_TOLERANCE) &&
- (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) > TYPE_TOLERANCE)) {
+ (abs(type - TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL) > TYPE_TOLERANCE) &&
+ (abs(type - TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL) > TYPE_TOLERANCE)) {
LOG(logERROR,
- ("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got %d\n",
- TYPE_GOTTHARD2_MODULE_VAL,
- TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL,
- TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL,
- type));
+ ("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got "
+ "%d\n",
+ TYPE_GOTTHARD2_MODULE_VAL, TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL,
+ TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL, type));
return FAIL;
}
return OK;
@@ -2083,6 +2085,61 @@ int getVCOFrequency(enum CLKINDEX ind) {
return ALTERA_PLL_C10_GetVCOFrequency(pllIndex);
}
+int setReadoutSpeed(int val) {
+ switch (val) {
+ case G2_108MHZ:
+ LOG(logINFOBLUE, ("Setting readout speed to 108 MHz\n"));
+ if (setClockDivider(READOUT_C0, SPEED_108_CLKDIV_0) == FAIL) {
+ return FAIL;
+ }
+ if (setClockDivider(READOUT_C1, SPEED_108_CLKDIV_1) == FAIL) {
+ return FAIL;
+ }
+ if (setPhase(READOUT_C1, SPEED_108_CLKPHASE_DEG_1, 1) == FAIL) {
+ return FAIL;
+ }
+ break;
+ case G2_144MHZ:
+ LOG(logINFOBLUE, ("Setting readout speed to 144 MHz\n"));
+ if (setClockDivider(READOUT_C0, SPEED_144_CLKDIV_0) == FAIL) {
+ return FAIL;
+ }
+ if (setClockDivider(READOUT_C1, SPEED_144_CLKDIV_1) == FAIL) {
+ return FAIL;
+ }
+ if (setPhase(READOUT_C1, SPEED_144_CLKPHASE_DEG_1, 1) == FAIL) {
+ return FAIL;
+ }
+ break;
+ default:
+ LOG(logERROR, ("Unknown readout speed %d\n", val));
+ return FAIL;
+ }
+ return OK;
+}
+
+int getReadoutSpeed(int *retval) {
+ // TODO ASIC and ADIFreg need to check????
+ // clkdiv 2, 3, 4, 5?
+ if (clkDivider[READOUT_C0] == SPEED_108_CLKDIV_0 &&
+ clkDivider[READOUT_C1] == SPEED_108_CLKDIV_1 &&
+ getPhase(READOUT_C1, 1) == SPEED_108_CLKPHASE_DEG_1) {
+ *retval = G2_108MHZ;
+ }
+
+ else if (clkDivider[READOUT_C0] == SPEED_144_CLKDIV_0 &&
+ clkDivider[READOUT_C1] == SPEED_144_CLKDIV_1 &&
+ getPhase(READOUT_C1, 1) == SPEED_144_CLKPHASE_DEG_1) {
+ *retval = G2_144MHZ;
+ }
+
+ else {
+ *retval = -1;
+ return FAIL;
+ }
+ return OK;
+}
+
int getMaxClockDivider() { return ALTERA_PLL_C10_GetMaxClockDivider(); }
int setClockDivider(enum CLKINDEX ind, int val) {
@@ -2095,8 +2152,8 @@ int setClockDivider(enum CLKINDEX ind, int val) {
}
char *clock_names[] = {CLK_NAMES};
- LOG(logINFO, ("\tSetting %s clock (%d) divider from %d to %d\n",
- clock_names[ind], ind, clkDivider[ind], val));
+ LOG(logINFOBLUE, ("Setting %s clock (%d) divider from %d to %d\n",
+ clock_names[ind], ind, clkDivider[ind], val));
// Remembering old phases in degrees
int oldPhases[NUM_CLOCKS];
diff --git a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h
index 6046fba9e..44fa5f4e6 100644
--- a/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h
+++ b/slsDetectorServers/gotthard2DetectorServer/slsDetectorServer_defs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/sls_detector_defs.h"
@@ -5,34 +7,36 @@
#define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020"
#define ID_FILE "detid_gotthard2.txt"
+#define LINKED_SERVER_NAME "gotthard2DetectorServer"
+
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
/* Hardware Definitions */
-#define NCHAN (128)
-#define NCHIP (10)
-#define NDAC (16)
-#define NADC (32)
-#define ONCHIP_NDAC (7)
-#define DYNAMIC_RANGE (16)
-#define HV_SOFT_MAX_VOLTAGE (500)
-#define HV_HARD_MAX_VOLTAGE (530)
-#define HV_DRIVER_FILE_NAME ("/etc/devlinks/hvdac")
-#define DAC_DRIVER_FILE_NAME ("/etc/devlinks/dac")
-#define ONCHIP_DAC_DRIVER_FILE_NAME ("/etc/devlinks/chipdac")
-#define TYPE_FILE_NAME ("/etc/devlinks/type")
-#define CONFIG_FILE ("config_gotthard2.txt")
-#define DAC_MAX_MV (2048)
-#define ONCHIP_DAC_MAX_VAL (0x3FF)
-#define ADU_MAX_VAL (0xFFF)
-#define ADU_MAX_BITS (12)
-#define MAX_FRAMES_IN_BURST_MODE (2720)
-#define TYPE_GOTTHARD2_MODULE_VAL (536)
-#define TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL (683)
-#define TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL (704)
-#define TYPE_GOTTHARD2_MODULE_VAL (536)
-#define TYPE_TOLERANCE (5)
-#define TYPE_NO_MODULE_STARTING_VAL (800)
-#define INITIAL_STARTUP_WAIT (1 * 1000 * 1000)
+#define NCHAN (128)
+#define NCHIP (10)
+#define NDAC (16)
+#define NADC (32)
+#define ONCHIP_NDAC (7)
+#define DYNAMIC_RANGE (16)
+#define HV_SOFT_MAX_VOLTAGE (500)
+#define HV_HARD_MAX_VOLTAGE (530)
+#define HV_DRIVER_FILE_NAME ("/etc/devlinks/hvdac")
+#define DAC_DRIVER_FILE_NAME ("/etc/devlinks/dac")
+#define ONCHIP_DAC_DRIVER_FILE_NAME ("/etc/devlinks/chipdac")
+#define TYPE_FILE_NAME ("/etc/devlinks/type")
+#define CONFIG_FILE ("config_gotthard2.txt")
+#define DAC_MAX_MV (2048)
+#define ONCHIP_DAC_MAX_VAL (0x3FF)
+#define ADU_MAX_VAL (0xFFF)
+#define ADU_MAX_BITS (12)
+#define MAX_FRAMES_IN_BURST_MODE (2720)
+#define TYPE_GOTTHARD2_MODULE_VAL (536)
+#define TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL (683)
+#define TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL (704)
+#define TYPE_GOTTHARD2_MODULE_VAL (536)
+#define TYPE_TOLERANCE (5)
+#define TYPE_NO_MODULE_STARTING_VAL (800)
+#define INITIAL_STARTUP_WAIT (1 * 1000 * 1000)
/** Default Parameters */
#define DEFAULT_BURST_MODE (BURST_INTERNAL)
@@ -52,13 +56,21 @@
#define DEFAULT_TIMING_SOURCE (TIMING_INTERNAL)
#define DEFAULT_ALGORITHM (ALG_HITS)
-#define DEFAULT_READOUT_C0 (8) //(108333336) // rdo_clk, 144 MHz
-#define DEFAULT_READOUT_C1 (8) //(108333336) // rdo_x2_clk, 144 MHz
+#define DEFAULT_READOUT_C0 (8) //(108333336) // rdo_clk, 144 MHz
+#define DEFAULT_READOUT_C1 (8) //(108333336) // rdo_x2_clk, 144 MHz
#define DEFAULT_SYSTEM_C0 (5) //(144444448) // run_clk, 144 MHz
#define DEFAULT_SYSTEM_C1 (10) //(72222224) // chip_clk, 72 MHz
#define DEFAULT_SYSTEM_C2 (5) //(144444448) // sync_clk, 144 MHz
#define DEFAULT_SYSTEM_C3 (5) //(144444448) // str_clk, 144 MHz
+#define DEFAULT_READOUT_SPEED (G2_108MHZ)
+#define SPEED_144_CLKDIV_0 (6)
+#define SPEED_144_CLKDIV_1 (6)
+#define SPEED_144_CLKPHASE_DEG_1 (122) // 125 not possible
+#define SPEED_108_CLKDIV_0 (8)
+#define SPEED_108_CLKDIV_1 (8)
+#define SPEED_108_CLKPHASE_DEG_1 (268) // 270 not possible
+
/* Firmware Definitions */
#define FIXED_PLL_FREQUENCY (20000000) // 20MHz
#define INT_SYSTEM_C0_FREQUENCY (144000000) // 144 MHz
@@ -70,7 +82,7 @@
#define DEFAULT_ASIC_DOUT_RDY_SRC (0x5)
#define DEFAULT_ASIC_DOUT_RDY_DLY (0x3)
-#define VETO_DATA_SIZE (160)
+#define VETO_DATA_SIZE (160)
typedef struct {
uint64_t frameNumber;
uint64_t bunchId;
@@ -149,17 +161,17 @@ enum PLLINDEX { READOUT_PLL, SYSTEM_PLL };
#define ASIC_ADC_MAX_VAL (0x7F)
#define ASIC_GLOBAL_SETT_MAX_BITS (6)
-#define ASIC_EXT_MEMCTRL_OFST (0)
-#define ASIC_EXT_MEMCTRL_MSK (0x1 << ASIC_EXT_MEMCTRL_OFST)
-#define ASIC_EXT_TIMING_OFST (1)
-#define ASIC_EXT_TIMING_MSK (0x1 << ASIC_EXT_TIMING_OFST)
-#define ASIC_CONT_MODE_OFST (2)
-#define ASIC_CONT_MODE_MSK (0x1 << ASIC_CONT_MODE_OFST)
-#define ASIC_FILTER_OFST (3)
-#define ASIC_FILTER_MSK (0x3 << ASIC_FILTER_OFST)
+#define ASIC_EXT_MEMCTRL_OFST (0)
+#define ASIC_EXT_MEMCTRL_MSK (0x1 << ASIC_EXT_MEMCTRL_OFST)
+#define ASIC_EXT_TIMING_OFST (1)
+#define ASIC_EXT_TIMING_MSK (0x1 << ASIC_EXT_TIMING_OFST)
+#define ASIC_CONT_MODE_OFST (2)
+#define ASIC_CONT_MODE_MSK (0x1 << ASIC_CONT_MODE_OFST)
+#define ASIC_FILTER_OFST (3)
+#define ASIC_FILTER_MSK (0x3 << ASIC_FILTER_OFST)
#define ASIC_FILTER_MAX_RES_VALUE (3)
-#define ASIC_CDS_GAIN_OFST (5)
-#define ASIC_CDS_GAIN_MSK (0x1 << ASIC_CDS_GAIN_OFST)
+#define ASIC_CDS_GAIN_OFST (5)
+#define ASIC_CDS_GAIN_MSK (0x1 << ASIC_CDS_GAIN_OFST)
/* Struct Definitions */
typedef struct udp_header_struct {
diff --git a/slsDetectorServers/gotthardDetectorServer/CMakeLists.txt b/slsDetectorServers/gotthardDetectorServer/CMakeLists.txt
index 8dc6bf58a..e2f7eac57 100644
--- a/slsDetectorServers/gotthardDetectorServer/CMakeLists.txt
+++ b/slsDetectorServers/gotthardDetectorServer/CMakeLists.txt
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
add_executable(gotthardDetectorServer_virtual
slsDetectorFunctionList.c
../slsDetectorServer/src/slsDetectorServer.c
diff --git a/slsDetectorServers/gotthardDetectorServer/Makefile b/slsDetectorServers/gotthardDetectorServer/Makefile
index 9544d991c..75bed6bb9 100755
--- a/slsDetectorServers/gotthardDetectorServer/Makefile
+++ b/slsDetectorServers/gotthardDetectorServer/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
current_dir = $(shell pwd)
main_inc = ../slsDetectorServer/include/
main_src = ../slsDetectorServer/src/
diff --git a/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h b/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h
index c8ba9c463..d04e80346 100644
--- a/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h
+++ b/slsDetectorServers/gotthardDetectorServer/RegisterDefs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
/* Definitions for FPGA*/
diff --git a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer
index 4fad0385a..420700477 100755
Binary files a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer and b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServer_developer differ
diff --git a/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv6.0.0-rc1 b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv6.0.0-rc1
new file mode 100755
index 000000000..c281e81ff
Binary files /dev/null and b/slsDetectorServers/gotthardDetectorServer/bin/gotthardDetectorServerv6.0.0-rc1 differ
diff --git a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c
index 895042dd6..1fd57beb4 100644
--- a/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c
+++ b/slsDetectorServers/gotthardDetectorServer/slsDetectorFunctionList.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "slsDetectorFunctionList.h"
#include "RegisterDefs.h"
#include "clogger.h"
diff --git a/slsDetectorServers/gotthardDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/gotthardDetectorServer/slsDetectorServer_defs.h
index f88039230..b91bb9ab2 100644
--- a/slsDetectorServers/gotthardDetectorServer/slsDetectorServer_defs.h
+++ b/slsDetectorServers/gotthardDetectorServer/slsDetectorServer_defs.h
@@ -1,7 +1,11 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/sls_detector_defs.h"
#include
+#define LINKED_SERVER_NAME "gotthardDetectorServer"
+
/* Enums */
enum ADCINDEX { TEMP_FPGA, TEMP_ADC };
enum DACINDEX {
diff --git a/slsDetectorServers/jungfrauDetectorServer/CMakeLists.txt b/slsDetectorServers/jungfrauDetectorServer/CMakeLists.txt
index d5d251e81..b1cd36a13 100644
--- a/slsDetectorServers/jungfrauDetectorServer/CMakeLists.txt
+++ b/slsDetectorServers/jungfrauDetectorServer/CMakeLists.txt
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
add_executable(jungfrauDetectorServer_virtual
slsDetectorFunctionList.c
../slsDetectorServer/src/slsDetectorServer.c
diff --git a/slsDetectorServers/jungfrauDetectorServer/Makefile b/slsDetectorServers/jungfrauDetectorServer/Makefile
index 054f2c62a..0468da861 100755
--- a/slsDetectorServers/jungfrauDetectorServer/Makefile
+++ b/slsDetectorServers/jungfrauDetectorServer/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
current_dir = $(shell pwd)
main_inc = ../slsDetectorServer/include/
main_src = ../slsDetectorServer/src/
diff --git a/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h b/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h
index 90db574f5..c632c3190 100644
--- a/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h
+++ b/slsDetectorServers/jungfrauDetectorServer/RegisterDefs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
// clang-format off
diff --git a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer
index 89b848b5b..a4707a077 100755
Binary files a/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer and b/slsDetectorServers/jungfrauDetectorServer/bin/jungfrauDetectorServer_developer differ
diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c
index 5ffd80ed3..8c54ca640 100644
--- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c
+++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorFunctionList.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "slsDetectorFunctionList.h"
#include "clogger.h"
#include "sharedMemory.h"
@@ -457,7 +459,7 @@ void setupDetector() {
return;
}
- setClockDivider(RUN_CLK, HALF_SPEED);
+ setReadoutSpeed(HALF_SPEED);
cleanFifos();
resetCore();
@@ -487,8 +489,6 @@ void setupDetector() {
// not applicable for chipv1.1
setStorageCellDelay(DEFAULT_STRG_CLL_DLY);
}
- /*setClockDivider(RUN_CLK, HALF_SPEED); depends if all the previous stuff
- * works*/
setTiming(DEFAULT_TIMING_MODE);
setNextFrameNumber(DEFAULT_STARTING_FRAME_NUMBER);
@@ -516,11 +516,11 @@ int resetToDefaultDacs(int hardReset) {
const int vals_G0[] = SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS;
for (int i = 0; i < NSPECIALDACS; ++i) {
defaultDacValue_G0[i] = vals_G0[i];
- }
+ }
const int vals_HG0[] = SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS;
for (int i = 0; i < NSPECIALDACS; ++i) {
defaultDacValue_HG0[i] = vals_HG0[i];
- }
+ }
}
// remember settings
@@ -734,7 +734,9 @@ int readConfigFile() {
// version 1.1 and HW 1.0 (version reg value = 2) is incompatible
if (version == 11 && isHardwareVersion2()) {
strcpy(initErrorMessage,
- "Chip version 1.1 (from on-board config file) is incompatible with old board (v1.0). Please update board or correct on-board config file.\n");
+ "Chip version 1.1 (from on-board config file) is "
+ "incompatible with old board (v1.0). Please update "
+ "board or correct on-board config file.\n");
break;
}
@@ -1352,7 +1354,9 @@ int setNumberofDestinations(int value) {
LOG(logINFO, ("Setting number of entries to %d\n", value));
--value;
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_RX_ADDTNL_ENDPTS_NUM_MSK);
- bus_w(CONTROL_REG, bus_r(CONTROL_REG) | ((value << CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST) & CONTROL_RX_ADDTNL_ENDPTS_NUM_MSK));
+ bus_w(CONTROL_REG,
+ bus_r(CONTROL_REG) | ((value << CONTROL_RX_ADDTNL_ENDPTS_NUM_OFST) &
+ CONTROL_RX_ADDTNL_ENDPTS_NUM_MSK));
return OK;
}
@@ -1391,7 +1395,7 @@ int getPrimaryInterface() {
void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
uint64_t destmac, uint32_t destport, uint64_t sourcemac,
uint32_t sourceip, uint32_t sourceport) {
-
+
// start addr
uint32_t addr = (type == INNER ? RXR_ENDPOINT_INNER_START_REG
: RXR_ENDPOINT_OUTER_START_REG);
@@ -1506,27 +1510,30 @@ int configureMAC() {
if (iRxEntry < numUdpDestinations) {
LOG(logINFOBLUE, ("\tEntry %d\n", iRxEntry));
- LOG(logINFO, ("\tOuter %s\n", (numInterfaces == 2)
- ? "(Bottom)"
- : (selInterface ? "Not Used" : "Used")));
+ LOG(logINFO,
+ ("\tOuter %s\n", (numInterfaces == 2)
+ ? "(Bottom)"
+ : (selInterface ? "Not Used" : "Used")));
LOG(logINFO, ("\tSource IP : %s\n"
- "\tSource MAC : %s\n"
- "\tSource Port : %d\n"
- "\tDest IP : %s\n"
- "\tDest MAC : %s\n"
- "\tDest Port : %d\n\n",
- src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
+ "\tSource MAC : %s\n"
+ "\tSource Port : %d\n"
+ "\tDest IP : %s\n"
+ "\tDest MAC : %s\n"
+ "\tDest Port : %d\n\n",
+ src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
- LOG(logINFO, ("\tInner %s\n", (numInterfaces == 2)
- ? "(Top)"
- : (selInterface ? "Used" : "Not Used")));
- LOG(logINFO, ("\tSource IP2 : %s\n"
- "\tSource MAC2 : %s\n"
- "\tSource Port2: %d\n"
- "\tDest IP2 : %s\n"
- "\tDest MAC2 : %s\n"
- "\tDest Port2 : %d\n\n",
- src_ip2, src_mac2, srcport2, dst_ip2, dst_mac2, dstport2));
+ LOG(logINFO,
+ ("\tInner %s\n", (numInterfaces == 2)
+ ? "(Top)"
+ : (selInterface ? "Used" : "Not Used")));
+ LOG(logINFO,
+ ("\tSource IP2 : %s\n"
+ "\tSource MAC2 : %s\n"
+ "\tSource Port2: %d\n"
+ "\tDest IP2 : %s\n"
+ "\tDest MAC2 : %s\n"
+ "\tDest Port2 : %d\n\n",
+ src_ip2, src_mac2, srcport2, dst_ip2, dst_mac2, dstport2));
}
#ifdef VIRTUAL
if (setUDPDestinationDetails(iRxEntry, 0, dst_ip, dstport) == FAIL) {
@@ -1548,18 +1555,18 @@ int configureMAC() {
setupHeader(iRxEntry, OUTER, dstip, dstmac, dstport, srcmac, srcip,
srcport);
// top
- setupHeader(iRxEntry, INNER, dstip2, dstmac2, dstport2, srcmac2, srcip2,
- srcport2);
+ setupHeader(iRxEntry, INNER, dstip2, dstmac2, dstport2, srcmac2,
+ srcip2, srcport2);
}
// single interface
else {
// default
if (selInterface == 0) {
- setupHeader(iRxEntry, OUTER, dstip, dstmac, dstport, srcmac, srcip,
- srcport);
+ setupHeader(iRxEntry, OUTER, dstip, dstmac, dstport, srcmac,
+ srcip, srcport);
} else {
- setupHeader(iRxEntry, INNER, dstip, dstmac, dstport, srcmac, srcip,
- srcport2);
+ setupHeader(iRxEntry, INNER, dstip, dstmac, dstport, srcmac,
+ srcip, srcport2);
}
}
}
@@ -1652,16 +1659,17 @@ int setReadNRows(int value) {
return FAIL;
}
- // regval is numpackets - 1
+ // regval is numpackets - 1
int regval = (value / READ_N_ROWS_MULTIPLE) - 1;
uint32_t addr = READ_N_ROWS_REG;
LOG(logINFO, ("Setting number of rows: %d (regval:%d)\n", value, regval));
- bus_w(addr, bus_r(addr) &~READ_N_ROWS_NUM_ROWS_MSK);
- bus_w(addr, bus_r(addr) | ((regval << READ_N_ROWS_NUM_ROWS_OFST) & READ_N_ROWS_NUM_ROWS_MSK));
+ bus_w(addr, bus_r(addr) & ~READ_N_ROWS_NUM_ROWS_MSK);
+ bus_w(addr, bus_r(addr) | ((regval << READ_N_ROWS_NUM_ROWS_OFST) &
+ READ_N_ROWS_NUM_ROWS_MSK));
if (value == MAX_ROWS_PER_READOUT) {
LOG(logINFO, ("Disabling Partial Readout (#rows)\n"));
- bus_w(addr, bus_r(addr) &~READ_N_ROWS_ENBL_MSK);
+ bus_w(addr, bus_r(addr) & ~READ_N_ROWS_ENBL_MSK);
} else {
LOG(logINFO, ("Enabling Partial Readout (#rows)\n"));
bus_w(addr, bus_r(addr) | READ_N_ROWS_ENBL_MSK);
@@ -1671,14 +1679,15 @@ int setReadNRows(int value) {
int getReadNRows() {
int enable = (bus_r(READ_N_ROWS_REG) & READ_N_ROWS_ENBL_MSK);
- int regval = ((bus_r(READ_N_ROWS_REG) & READ_N_ROWS_NUM_ROWS_MSK) >> READ_N_ROWS_NUM_ROWS_OFST);
-
- int maxRegval = (MAX_ROWS_PER_READOUT/ READ_N_ROWS_MULTIPLE) - 1;
+ int regval = ((bus_r(READ_N_ROWS_REG) & READ_N_ROWS_NUM_ROWS_MSK) >>
+ READ_N_ROWS_NUM_ROWS_OFST);
+
+ int maxRegval = (MAX_ROWS_PER_READOUT / READ_N_ROWS_MULTIPLE) - 1;
if ((regval == maxRegval && enable) || (regval != maxRegval && !enable)) {
return -1;
}
- return (regval + 1) * READ_N_ROWS_MULTIPLE;
+ return (regval + 1) * READ_N_ROWS_MULTIPLE;
}
void initReadoutConfiguration() {
@@ -1724,13 +1733,13 @@ int powerChip(int on) {
LOG(logINFOBLUE, ("Powering chip: on\n"));
bus_w(CHIP_POWER_REG,
bus_r(CHIP_POWER_REG) | CHIP_POWER_ENABLE_MSK);
-
- configureChip();
+
+ configureChip();
} else {
LOG(logINFOBLUE, ("Powering chip: off\n"));
bus_w(CHIP_POWER_REG,
bus_r(CHIP_POWER_REG) & ~CHIP_POWER_ENABLE_MSK);
-
+
chipConfigured = 0;
}
}
@@ -1742,21 +1751,19 @@ int powerChip(int on) {
CHIP_POWER_STATUS_OFST);
}
-int isChipConfigured() {
- return chipConfigured;
-}
+int isChipConfigured() { return chipConfigured; }
void configureChip() {
// only for chipv1.1 and chip is powered on
if (getChipVersion() == 11 && powerChip(-1)) {
LOG(logINFOBLUE, ("\tConfiguring chip\n"));
-
+
// waiting 500 ms before configuring selection
usleep(500 * 1000);
// write same values to configure selection
// if (chip was powered off earlier)
- LOG(logINFO, ("\tSetting default values for selection\n"))
+ LOG(logINFO, ("\tRewriting values for selection\n"))
bus_w(CRRNT_SRC_COL_LSB_REG, bus_r(CRRNT_SRC_COL_LSB_REG));
bus_w(CRRNT_SRC_COL_MSB_REG, bus_r(CRRNT_SRC_COL_MSB_REG));
@@ -1766,12 +1773,11 @@ void configureChip() {
// write same register values back to configure chip
bus_w(CONFIG_V11_REG, bus_r(CONFIG_V11_REG));
- LOG(logINFOBLUE, ("\tChip configured\n"));
+ LOG(logINFOBLUE, ("\tChip configured\n"));
chipConfigured = 1;
}
}
-
int autoCompDisable(int on) {
if (on != -1) {
if (on) {
@@ -1823,11 +1829,7 @@ void configureASICTimer() {
ASIC_CTRL_DS_TMR_VAL);
}
-int setClockDivider(enum CLKINDEX ind, int val) {
- if (ind != RUN_CLK) {
- LOG(logERROR, ("Unknown clock index %d to set speed\n", ind));
- return FAIL;
- }
+int setReadoutSpeed(int val) {
// stop state machine if running
if (runBusy()) {
stopStateMachine();
@@ -1847,14 +1849,17 @@ int setClockDivider(enum CLKINDEX ind, int val) {
return FAIL;
}
LOG(logINFO, ("Setting Full Speed (40 MHz):\n"));
- adcOfst = ADC_OFST_FULL_SPEED_VAL;
if (getChipVersion() == 10) {
sampleAdcSpeed = SAMPLE_ADC_FULL_SPEED_CHIP10;
+ adcPhase = ADC_PHASE_FULL_SPEED_CHIP10;
+ dbitPhase = DBIT_PHASE_FULL_SPEED_CHIP10;
+ adcOfst = ADC_OFST_FULL_SPEED_VAL_CHIP10;
} else {
- sampleAdcSpeed = SAMPLE_ADC_FULL_SPEED;
+ sampleAdcSpeed = SAMPLE_ADC_FULL_SPEED_CHIP11;
+ adcPhase = ADC_PHASE_FULL_SPEED_CHIP11;
+ dbitPhase = DBIT_PHASE_FULL_SPEED_CHIP11;
+ adcOfst = ADC_OFST_FULL_SPEED_VAL_CHIP11;
}
- adcPhase = ADC_PHASE_FULL_SPEED;
- dbitPhase = DBIT_PHASE_FULL_SPEED;
config = CONFIG_FULL_SPEED_40MHZ_VAL;
break;
@@ -1866,15 +1871,15 @@ int setClockDivider(enum CLKINDEX ind, int val) {
adcPhase = ADC_PHASE_HALF_SPEED_BOARD2;
dbitPhase = DBIT_PHASE_HALF_SPEED_BOARD2;
} else if (getChipVersion() == 10) {
- adcOfst = ADC_OFST_HALF_SPEED_VAL;
+ adcOfst = ADC_OFST_HALF_SPEED_VAL_CHIP10;
sampleAdcSpeed = SAMPLE_ADC_HALF_SPEED_CHIP10;
- adcPhase = ADC_PHASE_HALF_SPEED;
- dbitPhase = DBIT_PHASE_HALF_SPEED;
+ adcPhase = ADC_PHASE_HALF_SPEED_CHIP10;
+ dbitPhase = DBIT_PHASE_HALF_SPEED_CHIP10;
} else {
- adcOfst = ADC_OFST_HALF_SPEED_VAL;
- sampleAdcSpeed = SAMPLE_ADC_HALF_SPEED;
- adcPhase = ADC_PHASE_HALF_SPEED;
- dbitPhase = DBIT_PHASE_HALF_SPEED;
+ adcOfst = ADC_OFST_HALF_SPEED_VAL_CHIP11;
+ sampleAdcSpeed = SAMPLE_ADC_HALF_SPEED_CHIP11;
+ adcPhase = ADC_PHASE_HALF_SPEED_CHIP11;
+ dbitPhase = DBIT_PHASE_HALF_SPEED_CHIP11;
}
config = CONFIG_HALF_SPEED_20MHZ_VAL;
break;
@@ -1887,15 +1892,15 @@ int setClockDivider(enum CLKINDEX ind, int val) {
adcPhase = ADC_PHASE_QUARTER_SPEED_BOARD2;
dbitPhase = DBIT_PHASE_QUARTER_SPEED_BOARD2;
} else if (getChipVersion() == 10) {
- adcOfst = ADC_OFST_QUARTER_SPEED_VAL;
+ adcOfst = ADC_OFST_QUARTER_SPEED_VAL_CHIP10;
sampleAdcSpeed = SAMPLE_ADC_QUARTER_SPEED_CHIP10;
- adcPhase = ADC_PHASE_QUARTER_SPEED;
- dbitPhase = DBIT_PHASE_QUARTER_SPEED;
+ adcPhase = ADC_PHASE_QUARTER_SPEED_CHIP10;
+ dbitPhase = DBIT_PHASE_QUARTER_SPEED_CHIP10;
} else {
- adcOfst = ADC_OFST_QUARTER_SPEED_VAL;
- sampleAdcSpeed = SAMPLE_ADC_QUARTER_SPEED;
- adcPhase = ADC_PHASE_QUARTER_SPEED;
- dbitPhase = DBIT_PHASE_QUARTER_SPEED;
+ adcOfst = ADC_OFST_QUARTER_SPEED_VAL_CHIP11;
+ sampleAdcSpeed = SAMPLE_ADC_QUARTER_SPEED_CHIP11;
+ adcPhase = ADC_PHASE_QUARTER_SPEED_CHIP11;
+ dbitPhase = DBIT_PHASE_QUARTER_SPEED_CHIP11;
}
config = CONFIG_QUARTER_SPEED_10MHZ_VAL;
break;
@@ -1923,23 +1928,24 @@ int setClockDivider(enum CLKINDEX ind, int val) {
return OK;
}
-int getClockDivider(enum CLKINDEX ind) {
- if (ind != RUN_CLK) {
- LOG(logERROR, ("Unknown clock index %d to get speed\n", ind));
- return -1;
- }
+int getReadoutSpeed(int *retval) {
u_int32_t speed = bus_r(CONFIG_REG) & CONFIG_READOUT_SPEED_MSK;
switch (speed) {
case CONFIG_FULL_SPEED_40MHZ_VAL:
- return FULL_SPEED;
+ *retval = FULL_SPEED;
+ break;
case CONFIG_HALF_SPEED_20MHZ_VAL:
- return HALF_SPEED;
+ *retval = HALF_SPEED;
+ break;
case CONFIG_QUARTER_SPEED_10MHZ_VAL:
- return QUARTER_SPEED;
+ *retval = QUARTER_SPEED;
+ break;
default:
LOG(logERROR, ("Unknown speed val: %d\n", speed));
- return -1;
+ *retval = -1;
+ return FAIL;
}
+ return OK;
}
int setPhase(enum CLKINDEX ind, int val, int degrees) {
@@ -2191,24 +2197,31 @@ int getFilterCell() {
#else
uint32_t addr = CONFIG_V11_STATUS_REG;
#endif
- uint32_t value = (bus_r(addr) & CONFIG_V11_FLTR_CLL_MSK) >> CONFIG_V11_FLTR_CLL_OFST;
+ uint32_t value =
+ (bus_r(addr) & CONFIG_V11_FLTR_CLL_MSK) >> CONFIG_V11_FLTR_CLL_OFST;
// count number of bits = which icell
return (__builtin_popcount(value));
}
void setFilterCell(int iCell) {
- uint32_t value = 0;
- // sets the corresponding cell and the cells before it
- if (iCell != 0) {
- value = iCell;
- if (value > 1) {
- value += (value - 1);
- }
+ if (iCell > MAX_FILTER_CELL_VAL) {
+ return;
}
+
uint32_t addr = CONFIG_V11_REG;
- bus_w(addr, bus_r(addr) &~ CONFIG_V11_FLTR_CLL_MSK);
- bus_w(addr, bus_r(addr) | ((value << CONFIG_V11_FLTR_CLL_OFST) & CONFIG_V11_FLTR_CLL_MSK));
- LOG(logINFO, ("Setting Filter Cell to %d [Reg:0x%x]\n", iCell, bus_r(addr)));
+ bus_w(addr, bus_r(addr) & ~CONFIG_V11_FLTR_CLL_MSK);
+
+ if (iCell > 0) {
+ // enables as many cells
+ uint32_t value = 0;
+ for (int i = 0; i != iCell; ++i) {
+ value |= (1 << i);
+ }
+ bus_w(addr, bus_r(addr) | ((value << CONFIG_V11_FLTR_CLL_OFST) &
+ CONFIG_V11_FLTR_CLL_MSK));
+ }
+ LOG(logINFO,
+ ("Setting Filter Cell to %d [Reg:0x%x]\n", iCell, bus_r(addr)));
}
void disableCurrentSource() {
@@ -2228,15 +2241,16 @@ void disableCurrentSource() {
}
void enableCurrentSource(int fix, uint64_t select, int normal) {
+ disableCurrentSource();
+
if (getChipVersion() == 11) {
- LOG(logINFO, ("Enabling current source [fix:%d, select:%lld]\n", fix,
- (long long int)select));
+ LOG(logINFO, ("Enabling current source [fix:%d, select:0x%lx]\n", fix,
+ (long unsigned int)select));
} else {
LOG(logINFO,
- ("Enabling current source [fix:%d, select:0x%llx, normal:%d]\n",
- fix, (long long int)select, normal));
+ ("Enabling current source [fix:%d, select:%ld, normal:%d]\n", fix,
+ (long int)select, normal));
}
- disableCurrentSource();
// fix
if (fix) {
LOG(logINFO, ("\tEnabling fix\n"));
@@ -2247,7 +2261,7 @@ void enableCurrentSource(int fix, uint64_t select, int normal) {
}
if (getChipVersion() == 10) {
// select
- LOG(logINFO, ("\tSetting selection\n"))
+ LOG(logINFO, ("\tSetting selection to %ld\n", (long int)select));
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_CRRNT_SRC_CLMN_SLCT_MSK);
bus_w(DAQ_REG,
bus_r(DAQ_REG) | ((select << DAQ_CRRNT_SRC_CLMN_SLCT_OFST) &
@@ -2255,8 +2269,19 @@ void enableCurrentSource(int fix, uint64_t select, int normal) {
} else {
// select
- LOG(logINFO, ("\tSetting selection\n"))
- set64BitReg(select, CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG);
+ // invert select first
+ uint64_t tmp = select;
+ uint64_t inverted = 0;
+ for (int i = 0; i != 64; ++i) {
+ // get each bit from LSB side
+ uint64_t bit = (tmp >> i) & 0x1;
+ // push the bit into MSB side
+ inverted |= (bit << (63 - i));
+ }
+ LOG(logINFO, ("\tSetting selection to 0x%lx (inverted from 0x%lx)\n",
+ (long unsigned int)inverted, (long unsigned int)select));
+ set64BitReg(inverted, CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG);
+
// normal
if (normal) {
LOG(logINFO, ("\tEnabling normal\n"))
@@ -2309,7 +2334,19 @@ uint64_t getSelectCurrentSource() {
return ((bus_r(DAQ_REG) & DAQ_CRRNT_SRC_CLMN_SLCT_MSK) >>
DAQ_CRRNT_SRC_CLMN_SLCT_OFST);
} else {
- return get64BitReg(CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG);
+ // invert the select
+ uint64_t retval =
+ get64BitReg(CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG);
+
+ uint64_t tmp = retval;
+ uint64_t inverted = 0;
+ for (int i = 0; i != 64; ++i) {
+ // get each bit from LSB side
+ uint64_t bit = (tmp >> i) & 0x1;
+ // push the bit into MSB side
+ inverted |= (bit << (63 - i));
+ }
+ return inverted;
}
}
@@ -2462,7 +2499,7 @@ void *start_timer(void *arg) {
for (int i = 0; i != maxPacketsPerFrame; ++i) {
const int startval =
- (maxPacketsPerFrame / 2) - (packetsPerFrame / 2);
+ (maxPacketsPerFrame / 2) - (packetsPerFrame / 2);
const int endval = startval + packetsPerFrame - 1;
int pnum = i;
@@ -2511,14 +2548,16 @@ void *start_timer(void *arg) {
memcpy(packetData2 + sizeof(sls_detector_header),
imageData + srcOffset2, dataSize);
srcOffset2 += dataSize;
-
+
if (i >= startval && i <= endval) {
sendUDPPacket(iRxEntry, 1, packetData2, packetsize);
- LOG(logDEBUG1, ("Sent packet: %d [interface 1]\n", pnum));
+ LOG(logDEBUG1,
+ ("Sent packet: %d [interface 1]\n", pnum));
}
}
}
- LOG(logINFO, ("Sent frame %d [#%ld] to E%d\n", iframes, frameNr + iframes, iRxEntry));
+ LOG(logINFO, ("Sent frame %d [#%ld] to E%d\n", iframes,
+ frameNr + iframes, iRxEntry));
clock_gettime(CLOCK_REALTIME, &end);
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
(end.tv_nsec - begin.tv_nsec));
diff --git a/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h
index b7a98d9b0..67e899c24 100644
--- a/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h
+++ b/slsDetectorServers/jungfrauDetectorServer/slsDetectorServer_defs.h
@@ -1,10 +1,14 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "RegisterDefs.h"
#include "sls/sls_detector_defs.h"
#define MIN_REQRD_VRSN_T_RD_API 0x171220
#define REQRD_FRMWRE_VRSN_BOARD2 0x210831 // 1.0 pcb (version = 010)
-#define REQRD_FRMWRE_VRSN 0x210910 // 2.0 pcb (version = 011)
+#define REQRD_FRMWRE_VRSN 0x211008 // 2.0 pcb (version = 011)
+
+#define LINKED_SERVER_NAME "jungfrauDetectorServer"
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
@@ -63,9 +67,9 @@ enum DACINDEX {
420 /* J_VREF_COMP */ \
};
-#define NUMSETTINGS (2)
-#define NSPECIALDACS (3)
-#define SPECIALDACINDEX {J_VREF_PRECH, J_VREF_DS, J_VREF_COMP};
+#define NUMSETTINGS (2)
+#define NSPECIALDACS (3)
+#define SPECIALDACINDEX {J_VREF_PRECH, J_VREF_DS, J_VREF_COMP};
#define SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS \
{ 1450, 480, 420 }
#define SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS \
@@ -109,20 +113,20 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
#define DEFAULT_FILTER_RESISTOR (1) // higher resistor
#define DEFAULT_FILTER_CELL (0)
-#define HIGHVOLTAGE_MIN (60)
-#define HIGHVOLTAGE_MAX (200)
-#define DAC_MIN_MV (0)
-#define DAC_MAX_MV (2500)
-#define MAX_FILTER_CELL_VAL (12)
+#define HIGHVOLTAGE_MIN (60)
+#define HIGHVOLTAGE_MAX (200)
+#define DAC_MIN_MV (0)
+#define DAC_MAX_MV (2500)
+#define MAX_FILTER_CELL_VAL (12)
#define MIN_ROWS_PER_READOUT (8)
#define MAX_ROWS_PER_READOUT (512)
-#define READ_N_ROWS_MULTIPLE (8) //512 rows/128packets * 2 interfaces
-
+#define READ_N_ROWS_MULTIPLE (8) // 512 rows/128packets * 2 interfaces
+
/* Defines in the Firmware */
#define MAX_TIMESLOT_VAL (0x1F)
#define MAX_THRESHOLD_TEMP_VAL (127999) // millidegrees
#define MAX_STORAGE_CELL_VAL (15) // 0xF
-#define MAX_STORAGE_CELL_CHIP11_VAL (3)
+#define MAX_STORAGE_CELL_CHIP11_VAL (3)
#define MAX_STORAGE_CELL_DLY_NS_VAL (ASIC_CTRL_EXPSRE_TMR_MAX_VAL)
#define ACQ_TIME_MIN_CLOCK (2)
#define ASIC_FILTER_MAX_RES_VALUE (1)
@@ -132,26 +136,32 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
#define BIT16_MASK (0xFFFF)
// pipeline
-#define ADC_OFST_FULL_SPEED_VAL (0x10) // 2.0 pcb
-#define ADC_OFST_HALF_SPEED_VAL (0x08) // 2.0 pcb
-#define ADC_OFST_QUARTER_SPEED_VAL (0x04) // 2.0 pcb
-#define ADC_OFST_HALF_SPEED_BOARD2_VAL (0x10) // 1.0 pcb (2 resistor network)
-#define ADC_OFST_QUARTER_SPEED_BOARD2_VAL (0x08) // 1.0 pcb (2 resistor network)
-
#define ADC_PORT_INVERT_VAL (0x5A5A5A5A)
#define ADC_PORT_INVERT_BOARD2_VAL (0x453b2a9c)
// 2.0 pcb (chipv1.1)
-#define SAMPLE_ADC_FULL_SPEED \
+#define SAMPLE_ADC_FULL_SPEED_CHIP11 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + \
SAMPLE_DGTL_SAMPLE_0_VAL + SAMPLE_DECMT_FACTOR_FULL_VAL) // 0x0000
-#define SAMPLE_ADC_HALF_SPEED \
+#define SAMPLE_ADC_HALF_SPEED_CHIP11 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_1_VAL + \
SAMPLE_DGTL_SAMPLE_1_VAL + SAMPLE_DECMT_FACTOR_HALF_VAL) // 0x1110
-#define SAMPLE_ADC_QUARTER_SPEED \
+#define SAMPLE_ADC_QUARTER_SPEED_CHIP11 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_3_VAL + \
SAMPLE_DGTL_SAMPLE_2_VAL + SAMPLE_DECMT_FACTOR_QUARTER_VAL) // 0x2230
+#define ADC_PHASE_FULL_SPEED_CHIP11 (160)
+#define ADC_PHASE_HALF_SPEED_CHIP11 (160)
+#define ADC_PHASE_QUARTER_SPEED_CHIP11 (160)
+
+#define DBIT_PHASE_FULL_SPEED_CHIP11 (75)
+#define DBIT_PHASE_HALF_SPEED_CHIP11 (135)
+#define DBIT_PHASE_QUARTER_SPEED_CHIP11 (135)
+
+#define ADC_OFST_FULL_SPEED_VAL_CHIP11 (0x10)
+#define ADC_OFST_HALF_SPEED_VAL_CHIP11 (0x08)
+#define ADC_OFST_QUARTER_SPEED_VAL_CHIP11 (0x04)
+
// 2.0 pcb (chipv1.0)
#define SAMPLE_ADC_FULL_SPEED_CHIP10 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + \
@@ -163,6 +173,18 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_3_VAL + \
SAMPLE_DGTL_SAMPLE_6_VAL + SAMPLE_DECMT_FACTOR_QUARTER_VAL) // 0x2630
+#define ADC_PHASE_FULL_SPEED_CHIP10 (160)
+#define ADC_PHASE_HALF_SPEED_CHIP10 (160)
+#define ADC_PHASE_QUARTER_SPEED_CHIP10 (160)
+
+#define DBIT_PHASE_FULL_SPEED_CHIP10 (100)
+#define DBIT_PHASE_HALF_SPEED_CHIP10 (150)
+#define DBIT_PHASE_QUARTER_SPEED_CHIP10 (150)
+
+#define ADC_OFST_FULL_SPEED_VAL_CHIP10 (0x10)
+#define ADC_OFST_HALF_SPEED_VAL_CHIP10 (0x08)
+#define ADC_OFST_QUARTER_SPEED_VAL_CHIP10 (0x04)
+
// 1.0 pcb (2 resistor network)
#define SAMPLE_ADC_HALF_SPEED_BOARD2 \
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_0_VAL + \
@@ -171,14 +193,11 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
(SAMPLE_ADC_SAMPLE_0_VAL + SAMPLE_ADC_DECMT_FACTOR_1_VAL + \
SAMPLE_DGTL_SAMPLE_6_VAL + SAMPLE_DECMT_FACTOR_QUARTER_VAL) // 0x2610
-#define ADC_PHASE_FULL_SPEED (175) // 2.0 pcb
-#define ADC_PHASE_HALF_SPEED (175) // 2.0 pcb
-#define ADC_PHASE_QUARTER_SPEED (175) // 2.0 pcb
-#define ADC_PHASE_HALF_SPEED_BOARD2 (110) // 1.0 pcb (2 resistor network)
-#define ADC_PHASE_QUARTER_SPEED_BOARD2 (220) // 1.0 pcb (2 resistor network)
+#define ADC_PHASE_HALF_SPEED_BOARD2 (110)
+#define ADC_PHASE_QUARTER_SPEED_BOARD2 (220)
-#define DBIT_PHASE_FULL_SPEED (100) // 2.0 pcb
-#define DBIT_PHASE_HALF_SPEED (150) // 2.0 pcb
-#define DBIT_PHASE_QUARTER_SPEED (150) // 2.0 pcb
-#define DBIT_PHASE_HALF_SPEED_BOARD2 (150) // 1.0 pcb (2 resistor network)
-#define DBIT_PHASE_QUARTER_SPEED_BOARD2 (150) // 1.0 pcb (2 resistor network)
+#define DBIT_PHASE_HALF_SPEED_BOARD2 (150)
+#define DBIT_PHASE_QUARTER_SPEED_BOARD2 (150)
+
+#define ADC_OFST_HALF_SPEED_BOARD2_VAL (0x10)
+#define ADC_OFST_QUARTER_SPEED_BOARD2_VAL (0x08)
diff --git a/slsDetectorServers/moenchDetectorServer/CMakeLists.txt b/slsDetectorServers/moenchDetectorServer/CMakeLists.txt
index 8a2a02ed6..de0923b87 100644
--- a/slsDetectorServers/moenchDetectorServer/CMakeLists.txt
+++ b/slsDetectorServers/moenchDetectorServer/CMakeLists.txt
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
add_executable(moenchDetectorServer_virtual
slsDetectorFunctionList.c
../slsDetectorServer/src/slsDetectorServer.c
diff --git a/slsDetectorServers/moenchDetectorServer/Makefile b/slsDetectorServers/moenchDetectorServer/Makefile
index 3091c6564..f08d178e1 100755
--- a/slsDetectorServers/moenchDetectorServer/Makefile
+++ b/slsDetectorServers/moenchDetectorServer/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
current_dir = $(shell pwd)
main_inc = ../slsDetectorServer/include/
main_src = ../slsDetectorServer/src/
diff --git a/slsDetectorServers/moenchDetectorServer/RegisterDefs.h b/slsDetectorServers/moenchDetectorServer/RegisterDefs.h
index faf82eb9e..26718e885 100644
--- a/slsDetectorServers/moenchDetectorServer/RegisterDefs.h
+++ b/slsDetectorServers/moenchDetectorServer/RegisterDefs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
/* Definitions for FPGA */
diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer
index 76bd9cefb..3b9443386 100755
Binary files a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServer_developer differ
diff --git a/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv6.0.0-rc1 b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv6.0.0-rc1
new file mode 100755
index 000000000..e8095c31a
Binary files /dev/null and b/slsDetectorServers/moenchDetectorServer/bin/moenchDetectorServerv6.0.0-rc1 differ
diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c
index bdda08571..1c0c703fd 100644
--- a/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c
+++ b/slsDetectorServers/moenchDetectorServer/slsDetectorFunctionList.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "slsDetectorFunctionList.h"
#include "clogger.h"
#include "sharedMemory.h"
@@ -1579,7 +1581,6 @@ int getADCPipeline() {
ADC_OFFSET_ADC_PPLN_OFST);
}
-
/* aquisition */
int startStateMachine() {
diff --git a/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h
index aa17e8047..a86f350d2 100644
--- a/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h
+++ b/slsDetectorServers/moenchDetectorServer/slsDetectorServer_defs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "RegisterDefs.h"
#include "sls/sls_detector_defs.h"
@@ -5,6 +7,8 @@
#define MIN_REQRD_VRSN_T_RD_API 0x180314
#define REQRD_FRMWR_VRSN 0x201005
+#define LINKED_SERVER_NAME "moenchDetectorServer"
+
#define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000)
/* Struct Definitions */
diff --git a/slsDetectorServers/mythen3DetectorServer/CMakeLists.txt b/slsDetectorServers/mythen3DetectorServer/CMakeLists.txt
index aee0a6b57..9033f5200 100644
--- a/slsDetectorServers/mythen3DetectorServer/CMakeLists.txt
+++ b/slsDetectorServers/mythen3DetectorServer/CMakeLists.txt
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
add_executable(mythen3DetectorServer_virtual
slsDetectorFunctionList.c
mythen3.c
diff --git a/slsDetectorServers/mythen3DetectorServer/Makefile b/slsDetectorServers/mythen3DetectorServer/Makefile
index f8fb7e3c4..29e39f6b2 100755
--- a/slsDetectorServers/mythen3DetectorServer/Makefile
+++ b/slsDetectorServers/mythen3DetectorServer/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
current_dir = $(shell pwd)
main_inc = ../slsDetectorServer/include/
main_src = ../slsDetectorServer/src/
diff --git a/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h b/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h
index ffa134e38..a68efb19b 100644
--- a/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h
+++ b/slsDetectorServers/mythen3DetectorServer/RegisterDefs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
// clang-format off
diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer
index 3d102c2df..0a6059037 100755
Binary files a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServer_developer differ
diff --git a/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv6.0.0-rc1 b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv6.0.0-rc1
new file mode 100755
index 000000000..60f3c2e14
Binary files /dev/null and b/slsDetectorServers/mythen3DetectorServer/bin/mythen3DetectorServerv6.0.0-rc1 differ
diff --git a/slsDetectorServers/mythen3DetectorServer/mythen3.c b/slsDetectorServers/mythen3DetectorServer/mythen3.c
index 64f4bdb11..88d13b4ea 100644
--- a/slsDetectorServers/mythen3DetectorServer/mythen3.c
+++ b/slsDetectorServers/mythen3DetectorServer/mythen3.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "mythen3.h"
#include "clogger.h"
@@ -90,7 +92,7 @@ patternParameters *setChipStatusRegisterPattern(int csr) {
for (int i = 0; i < 8; i++)
pat->word[iaddr++] = patword;
//#This version of the serializer pushes in the MSB first (compatible with
- //the CSR bit numbering)
+ // the CSR bit numbering)
for (int ib = nbits - 1; ib >= 0; ib--) {
if (csr & (1 << ib))
patword = setBit(SIGNAL_serialIN, patword);
diff --git a/slsDetectorServers/mythen3DetectorServer/mythen3.h b/slsDetectorServers/mythen3DetectorServer/mythen3.h
index c27e7189e..16b691250 100644
--- a/slsDetectorServers/mythen3DetectorServer/mythen3.h
+++ b/slsDetectorServers/mythen3DetectorServer/mythen3.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef MYTHEN3_H
#define MYTHEN3_H
@@ -31,25 +33,27 @@
#define SIGNAL_CHSclk (24)
#define SIGNAL_exposing (25)
-
-//CHIP STARTUS REGISTER BITS
+// CHIP STARTUS REGISTER BITS
#define CSR_spypads 0
-#define CSR_invpol 4
-#define CSR_dpulse 5
-#define CSR_interp 6
+#define CSR_invpol 4
+#define CSR_dpulse 5
+#define CSR_interp 6
#define _CSR_C10pre 7 //#default, negative polarity
-#define CSR_pumprobe 8
-#define CSR_apulse 9
-#define CSR_C15sh 10
-#define CSR_C30sh 11 //#default
-#define CSR_C50sh 12
-#define CSR_C225ACsh 13 // Connects 225fF SHAPER AC cap (1: 225 to shaper, 225 to GND. 0: 450 to shaper)
-#define _CSR_C15pre 14 // negative polarity
+#define CSR_pumprobe 8
+#define CSR_apulse 9
+#define CSR_C15sh 10
+#define CSR_C30sh 11 //#default
+#define CSR_C50sh 12
+#define CSR_C225ACsh \
+ 13 // Connects 225fF SHAPER AC cap (1: 225 to shaper, 225 to GND. 0: 450 to
+ // shaper)
+#define _CSR_C15pre 14 // negative polarity
-#define CSR_default (1<<_CSR_C10pre )|(1<< CSR_C30sh)
-
-#define GAIN_MASK ((1 << _CSR_C10pre) | ( 1 << CSR_C15sh) | (1 << CSR_C30sh) | (1 << CSR_C50sh) | (1 << CSR_C225ACsh) | ( 1 << _CSR_C15pre))
+#define CSR_default (1 << _CSR_C10pre) | (1 << CSR_C30sh)
+#define GAIN_MASK \
+ ((1 << _CSR_C10pre) | (1 << CSR_C15sh) | (1 << CSR_C30sh) | \
+ (1 << CSR_C50sh) | (1 << CSR_C225ACsh) | (1 << _CSR_C15pre))
int setBit(int ibit, int patword);
int clearBit(int ibit, int patword);
diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c
index b70da61c7..51a0c0895 100644
--- a/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c
+++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorFunctionList.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "slsDetectorFunctionList.h"
#include "ALTERA_PLL_CYCLONE10.h"
#include "DAC6571.h"
@@ -281,7 +283,6 @@ u_int32_t getDetectorNumber() {
return bus_r(MCB_SERIAL_NO_REG);
}
-
int getModuleId(int *ret, char *mess) {
return ((bus_r(MOD_ID_REG) & MOD_ID_MSK) >> MOD_ID_OFST);
}
@@ -541,18 +542,18 @@ int resetToDefaultDacs(int hardReset) {
for (int i = 0; i < NDAC; ++i) {
defaultDacValues[i] = vals[i];
}
- const int vals_standard[] = SPECIAL_DEFAULT_STANDARD_DAC_VALS;
+ const int vals_standard[] = SPECIAL_DEFAULT_STANDARD_DAC_VALS;
for (int i = 0; i < NSPECIALDACS; ++i) {
defaultDacValue_standard[i] = vals_standard[i];
- }
+ }
const int vals_fast[] = SPECIAL_DEFAULT_FAST_DAC_VALS;
for (int i = 0; i < NSPECIALDACS; ++i) {
defaultDacValue_fast[i] = vals_fast[i];
- }
- const int vals_highgain[] = SPECIAL_DEFAULT_HIGHGAIN_DAC_VALS;
+ }
+ const int vals_highgain[] = SPECIAL_DEFAULT_HIGHGAIN_DAC_VALS;
for (int i = 0; i < NSPECIALDACS; ++i) {
defaultDacValue_highgain[i] = vals_highgain[i];
- }
+ }
}
// remember settings
diff --git a/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h b/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h
index f39da11b8..06ee3b36b 100644
--- a/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h
+++ b/slsDetectorServers/mythen3DetectorServer/slsDetectorServer_defs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/sls_detector_defs.h"
@@ -5,6 +7,8 @@
#define KERNEL_DATE_VRSN "Wed May 20 13:58:38 CEST 2020"
#define ID_FILE "detid_mythen3.txt"
+#define LINKED_SERVER_NAME "mythen3DetectorServer"
+
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
/* Hardware Definitions */
diff --git a/slsDetectorServers/slsDetectorServer/include/AD7689.h b/slsDetectorServers/slsDetectorServer/include/AD7689.h
index e30a0e8ed..020f64a03 100644
--- a/slsDetectorServers/slsDetectorServer/include/AD7689.h
+++ b/slsDetectorServers/slsDetectorServer/include/AD7689.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/AD9252.h b/slsDetectorServers/slsDetectorServer/include/AD9252.h
index 2982a1962..b2787ef99 100644
--- a/slsDetectorServers/slsDetectorServer/include/AD9252.h
+++ b/slsDetectorServers/slsDetectorServer/include/AD9252.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/AD9257.h b/slsDetectorServers/slsDetectorServer/include/AD9257.h
index 333050106..2989e7010 100644
--- a/slsDetectorServers/slsDetectorServer/include/AD9257.h
+++ b/slsDetectorServers/slsDetectorServer/include/AD9257.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/ALTERA_PLL.h b/slsDetectorServers/slsDetectorServer/include/ALTERA_PLL.h
index b3187260b..57e6fac7d 100644
--- a/slsDetectorServers/slsDetectorServer/include/ALTERA_PLL.h
+++ b/slsDetectorServers/slsDetectorServer/include/ALTERA_PLL.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/ALTERA_PLL_CYCLONE10.h b/slsDetectorServers/slsDetectorServer/include/ALTERA_PLL_CYCLONE10.h
index 8044323ee..67d2de757 100644
--- a/slsDetectorServers/slsDetectorServer/include/ALTERA_PLL_CYCLONE10.h
+++ b/slsDetectorServers/slsDetectorServer/include/ALTERA_PLL_CYCLONE10.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/ASIC_Driver.h b/slsDetectorServers/slsDetectorServer/include/ASIC_Driver.h
index 597022a12..b6ba53632 100644
--- a/slsDetectorServers/slsDetectorServer/include/ASIC_Driver.h
+++ b/slsDetectorServers/slsDetectorServer/include/ASIC_Driver.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/DAC6571.h b/slsDetectorServers/slsDetectorServer/include/DAC6571.h
index 41bac9486..1a13d3c14 100644
--- a/slsDetectorServers/slsDetectorServer/include/DAC6571.h
+++ b/slsDetectorServers/slsDetectorServer/include/DAC6571.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/I2C.h b/slsDetectorServers/slsDetectorServer/include/I2C.h
index e8fd1a332..19d6debe1 100644
--- a/slsDetectorServers/slsDetectorServer/include/I2C.h
+++ b/slsDetectorServers/slsDetectorServer/include/I2C.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/INA226.h b/slsDetectorServers/slsDetectorServer/include/INA226.h
index 20ed47b4b..b7e39c2a8 100644
--- a/slsDetectorServers/slsDetectorServer/include/INA226.h
+++ b/slsDetectorServers/slsDetectorServer/include/INA226.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/LTC2620.h b/slsDetectorServers/slsDetectorServer/include/LTC2620.h
index 5d053af44..b9841f615 100644
--- a/slsDetectorServers/slsDetectorServer/include/LTC2620.h
+++ b/slsDetectorServers/slsDetectorServer/include/LTC2620.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/LTC2620_Driver.h b/slsDetectorServers/slsDetectorServer/include/LTC2620_Driver.h
index 78c05a199..6a05cde62 100644
--- a/slsDetectorServers/slsDetectorServer/include/LTC2620_Driver.h
+++ b/slsDetectorServers/slsDetectorServer/include/LTC2620_Driver.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/MAX1932.h b/slsDetectorServers/slsDetectorServer/include/MAX1932.h
index 4eccf05f4..e19e0c8da 100644
--- a/slsDetectorServers/slsDetectorServer/include/MAX1932.h
+++ b/slsDetectorServers/slsDetectorServer/include/MAX1932.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/UDPPacketHeaderGenerator.h b/slsDetectorServers/slsDetectorServer/include/UDPPacketHeaderGenerator.h
index 51c8ff246..2b401439d 100644
--- a/slsDetectorServers/slsDetectorServer/include/UDPPacketHeaderGenerator.h
+++ b/slsDetectorServers/slsDetectorServer/include/UDPPacketHeaderGenerator.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/blackfin.h b/slsDetectorServers/slsDetectorServer/include/blackfin.h
index a1995cfa9..e3a2d50f7 100644
--- a/slsDetectorServers/slsDetectorServer/include/blackfin.h
+++ b/slsDetectorServers/slsDetectorServer/include/blackfin.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/clogger.h b/slsDetectorServers/slsDetectorServer/include/clogger.h
index cfcb63f07..9f392535c 100644
--- a/slsDetectorServers/slsDetectorServer/include/clogger.h
+++ b/slsDetectorServers/slsDetectorServer/include/clogger.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/ansi.h"
diff --git a/slsDetectorServers/slsDetectorServer/include/common.h b/slsDetectorServers/slsDetectorServer/include/common.h
index 5b6c98a41..6a0ab83c2 100644
--- a/slsDetectorServers/slsDetectorServer/include/common.h
+++ b/slsDetectorServers/slsDetectorServer/include/common.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/md5.h"
diff --git a/slsDetectorServers/slsDetectorServer/include/commonServerFunctions.h b/slsDetectorServers/slsDetectorServer/include/commonServerFunctions.h
index 3f5cb9e7e..e93b485b9 100644
--- a/slsDetectorServers/slsDetectorServer/include/commonServerFunctions.h
+++ b/slsDetectorServers/slsDetectorServer/include/commonServerFunctions.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/communication_funcs.h b/slsDetectorServers/slsDetectorServer/include/communication_funcs.h
index 21e59476a..1618e857d 100644
--- a/slsDetectorServers/slsDetectorServer/include/communication_funcs.h
+++ b/slsDetectorServers/slsDetectorServer/include/communication_funcs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef COMMUNICATION_FUNCS_H
#define COMMUNICATION_FUNCS_H
diff --git a/slsDetectorServers/slsDetectorServer/include/communication_funcs_UDP.h b/slsDetectorServers/slsDetectorServer/include/communication_funcs_UDP.h
index 3ba9f251d..ecd9d5deb 100644
--- a/slsDetectorServers/slsDetectorServer/include/communication_funcs_UDP.h
+++ b/slsDetectorServers/slsDetectorServer/include/communication_funcs_UDP.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
void setupUDPCommParameters();
diff --git a/slsDetectorServers/slsDetectorServer/include/loadPattern.h b/slsDetectorServers/slsDetectorServer/include/loadPattern.h
index d2e2e43ff..84f73b8b4 100644
--- a/slsDetectorServers/slsDetectorServer/include/loadPattern.h
+++ b/slsDetectorServers/slsDetectorServer/include/loadPattern.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef LOADPATTERN_H
#define LOADPATTERN_H
#include "Pattern.h"
diff --git a/slsDetectorServers/slsDetectorServer/include/nios.h b/slsDetectorServers/slsDetectorServer/include/nios.h
index 128f556cf..33b0d4252 100644
--- a/slsDetectorServers/slsDetectorServer/include/nios.h
+++ b/slsDetectorServers/slsDetectorServer/include/nios.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/programFpgaBlackfin.h b/slsDetectorServers/slsDetectorServer/include/programFpgaBlackfin.h
index 0fff822d2..23ce5e252 100644
--- a/slsDetectorServers/slsDetectorServer/include/programFpgaBlackfin.h
+++ b/slsDetectorServers/slsDetectorServer/include/programFpgaBlackfin.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
diff --git a/slsDetectorServers/slsDetectorServer/include/programFpgaNios.h b/slsDetectorServers/slsDetectorServer/include/programFpgaNios.h
index c999a8da1..7e9d0be7c 100644
--- a/slsDetectorServers/slsDetectorServer/include/programFpgaNios.h
+++ b/slsDetectorServers/slsDetectorServer/include/programFpgaNios.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
@@ -11,7 +13,8 @@ void NotifyServerStartSuccess();
/** reset fpga and controller(only implemented for >= v1.1 boards) */
void rebootControllerAndFPGA();
-int eraseAndWriteToFlash(char *mess, char *checksum, char *fpgasrc, uint64_t fsize);
+int eraseAndWriteToFlash(char *mess, char *checksum, char *fpgasrc,
+ uint64_t fsize);
int getDrive(char *mess);
int openFileForFlash(FILE **flashfd, char *mess);
int eraseFlash(char *mess);
diff --git a/slsDetectorServers/slsDetectorServer/include/sharedMemory.h b/slsDetectorServers/slsDetectorServer/include/sharedMemory.h
index 8146dfbc1..297312df0 100644
--- a/slsDetectorServers/slsDetectorServer/include/sharedMemory.h
+++ b/slsDetectorServers/slsDetectorServer/include/sharedMemory.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/sls_detector_defs.h"
diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h
index cc0a97938..0f8f4a638 100644
--- a/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h
+++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorFunctionList.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "sls/sls_detector_defs.h"
#include "slsDetectorServer_defs.h" // DAC_INDEX, ADC_INDEX, also include RegisterDefs.h
#ifdef GOTTHARDD
@@ -470,8 +472,8 @@ int autoCompDisable(int on);
int setComparatorDisableTime(int64_t val);
int64_t getComparatorDisableTime();
void configureASICTimer();
-int setClockDivider(enum CLKINDEX ind, int val);
-int getClockDivider(enum CLKINDEX ind);
+int setReadoutSpeed(int val);
+int getReadoutSpeed(int *retval);
int setPhase(enum CLKINDEX ind, int val, int degrees);
int getPhase(enum CLKINDEX ind, int degrees);
int getMaxPhase(enum CLKINDEX ind);
@@ -495,8 +497,8 @@ uint64_t getSelectCurrentSource();
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter
#elif EIGERD
-int setClockDivider(enum CLKINDEX ind, int val);
-int getClockDivider(enum CLKINDEX ind);
+int setReadoutSpeed(int val);
+int getReadoutSpeed(int *retval);
int setIODelay(int val);
int setCounterBit(int val);
int pulsePixel(int n, int x, int y);
@@ -548,6 +550,8 @@ int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval);
// void setFrequency(enum CLKINDEX ind, int val);
int getFrequency(enum CLKINDEX ind);
int getVCOFrequency(enum CLKINDEX ind);
+int setReadoutSpeed(int val);
+int getReadoutSpeed(int *retval);
int getMaxClockDivider();
int setClockDivider(enum CLKINDEX ind, int val);
int getClockDivider(enum CLKINDEX ind);
diff --git a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h
index bedad75f6..a8be872ab 100644
--- a/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h
+++ b/slsDetectorServers/slsDetectorServer/include/slsDetectorServer_funcs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "clogger.h"
#include "common.h"
@@ -272,4 +274,6 @@ int set_dest_udp_list(int);
int get_num_dest_list(int);
int clear_all_udp_dst(int);
int get_udp_first_dest(int);
-int set_udp_first_dest(int);
\ No newline at end of file
+int set_udp_first_dest(int);
+int get_readout_speed(int);
+int set_readout_speed(int);
\ No newline at end of file
diff --git a/slsDetectorServers/slsDetectorServer/src/AD7689.c b/slsDetectorServers/slsDetectorServer/src/AD7689.c
index b83e70a1f..066424816 100644
--- a/slsDetectorServers/slsDetectorServer/src/AD7689.c
+++ b/slsDetectorServers/slsDetectorServer/src/AD7689.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "AD7689.h"
#include "blackfin.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/AD9252.c b/slsDetectorServers/slsDetectorServer/src/AD9252.c
index 9f0ed3bcf..164e2dc13 100644
--- a/slsDetectorServers/slsDetectorServer/src/AD9252.c
+++ b/slsDetectorServers/slsDetectorServer/src/AD9252.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "AD9252.h"
#include "blackfin.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/AD9257.c b/slsDetectorServers/slsDetectorServer/src/AD9257.c
index 68cc42cee..20502922d 100644
--- a/slsDetectorServers/slsDetectorServer/src/AD9257.c
+++ b/slsDetectorServers/slsDetectorServer/src/AD9257.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "AD9257.h"
#include "blackfin.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL.c b/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL.c
index dab4a66cc..2d03c673c 100644
--- a/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL.c
+++ b/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "ALTERA_PLL.h"
#include "blackfin.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c b/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
index 12849f106..fcf60e68b 100644
--- a/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
+++ b/slsDetectorServers/slsDetectorServer/src/ALTERA_PLL_CYCLONE10.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "ALTERA_PLL_CYCLONE10.h"
#include "clogger.h"
#include "nios.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c b/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c
index e084557f9..562396b16 100644
--- a/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c
+++ b/slsDetectorServers/slsDetectorServer/src/ASIC_Driver.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "ASIC_Driver.h"
#include "clogger.h"
#include "common.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/DAC6571.c b/slsDetectorServers/slsDetectorServer/src/DAC6571.c
index 26b3cac68..3ed121aae 100644
--- a/slsDetectorServers/slsDetectorServer/src/DAC6571.c
+++ b/slsDetectorServers/slsDetectorServer/src/DAC6571.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "DAC6571.h"
#include "clogger.h"
#include "common.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/I2C.c b/slsDetectorServers/slsDetectorServer/src/I2C.c
index 3172fa2cb..31efc129a 100644
--- a/slsDetectorServers/slsDetectorServer/src/I2C.c
+++ b/slsDetectorServers/slsDetectorServer/src/I2C.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "I2C.h"
#include "blackfin.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/INA226.c b/slsDetectorServers/slsDetectorServer/src/INA226.c
index cf2c792dd..2c7d2297e 100644
--- a/slsDetectorServers/slsDetectorServer/src/INA226.c
+++ b/slsDetectorServers/slsDetectorServer/src/INA226.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "INA226.h"
#include "I2C.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/LTC2620.c b/slsDetectorServers/slsDetectorServer/src/LTC2620.c
index d3c80f03a..ab28d4c8a 100644
--- a/slsDetectorServers/slsDetectorServer/src/LTC2620.c
+++ b/slsDetectorServers/slsDetectorServer/src/LTC2620.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "LTC2620.h"
#include "blackfin.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/LTC2620_Driver.c b/slsDetectorServers/slsDetectorServer/src/LTC2620_Driver.c
index be331225b..5add339b1 100644
--- a/slsDetectorServers/slsDetectorServer/src/LTC2620_Driver.c
+++ b/slsDetectorServers/slsDetectorServer/src/LTC2620_Driver.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "LTC2620_Driver.h"
#include "clogger.h"
#include "common.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/MAX1932.c b/slsDetectorServers/slsDetectorServer/src/MAX1932.c
index 833d18d50..2edf69f27 100644
--- a/slsDetectorServers/slsDetectorServer/src/MAX1932.c
+++ b/slsDetectorServers/slsDetectorServer/src/MAX1932.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "MAX1932.h"
#include "blackfin.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/UDPPacketHeaderGenerator.c b/slsDetectorServers/slsDetectorServer/src/UDPPacketHeaderGenerator.c
index 89d760db2..df6cbd525 100644
--- a/slsDetectorServers/slsDetectorServer/src/UDPPacketHeaderGenerator.c
+++ b/slsDetectorServers/slsDetectorServer/src/UDPPacketHeaderGenerator.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "UDPPacketHeaderGenerator.h"
#include "clogger.h"
#include "sls/sls_detector_defs.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/blackfin.c b/slsDetectorServers/slsDetectorServer/src/blackfin.c
index 6d8ad90f7..3976a5d89 100644
--- a/slsDetectorServers/slsDetectorServer/src/blackfin.c
+++ b/slsDetectorServers/slsDetectorServer/src/blackfin.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "blackfin.h"
#include "RegisterDefs.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/common.c b/slsDetectorServers/slsDetectorServer/src/common.c
index 618187215..5c2390172 100644
--- a/slsDetectorServers/slsDetectorServer/src/common.c
+++ b/slsDetectorServers/slsDetectorServer/src/common.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#define _GNU_SOURCE // needed for strptime to be at the top
#include "common.h"
#include "clogger.h"
@@ -7,7 +9,6 @@
#include
#include // readlink
-
int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin,
int outputMax, int inputValue, int *outputValue) {
LOG(logDEBUG1, (" Input Value: %d (Input:(%d - %d), Output:(%d - %d))\n",
@@ -243,7 +244,8 @@ int verifyChecksumFromFlash(char *mess, char *clientChecksum, char *fname,
// read only until a particular size (drive)
if (fsize != 0 && totalBytesRead >= fsize) {
- LOG(logINFO, ("\tReached %lu bytes. Not reading more\n", totalBytesRead));
+ LOG(logINFO,
+ ("\tReached %lu bytes. Not reading more\n", totalBytesRead));
break;
}
bytes = fread(buf, 1, readUnitSize, fp);
diff --git a/slsDetectorServers/slsDetectorServer/src/commonServerFunctions.c b/slsDetectorServers/slsDetectorServer/src/commonServerFunctions.c
index 5b90b51d9..7026ba407 100644
--- a/slsDetectorServers/slsDetectorServer/src/commonServerFunctions.c
+++ b/slsDetectorServers/slsDetectorServer/src/commonServerFunctions.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "commonServerFunctions.h"
#include "blackfin.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/communication_funcs.c b/slsDetectorServers/slsDetectorServer/src/communication_funcs.c
index 29b7d2941..f176012a7 100644
--- a/slsDetectorServers/slsDetectorServer/src/communication_funcs.c
+++ b/slsDetectorServers/slsDetectorServer/src/communication_funcs.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "communication_funcs.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/communication_funcs_UDP.c b/slsDetectorServers/slsDetectorServer/src/communication_funcs_UDP.c
index 95a0fc641..d74c8ca6b 100644
--- a/slsDetectorServers/slsDetectorServer/src/communication_funcs_UDP.c
+++ b/slsDetectorServers/slsDetectorServer/src/communication_funcs_UDP.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "communication_funcs_UDP.h"
#include "clogger.h"
#include "sls/sls_detector_defs.h"
@@ -28,8 +30,9 @@ void setupUDPCommParameters() {
memset(udpDestinationIp, 0, sizeof(udpDestinationIp));
}
-int getUdPSocketDescriptor(int iRxEntry, int index) { return udpSockfd[iRxEntry][index]; }
-
+int getUdPSocketDescriptor(int iRxEntry, int index) {
+ return udpSockfd[iRxEntry][index];
+}
int setUDPDestinationDetails(int iRxEntry, int index, const char *ip,
unsigned short int port) {
@@ -60,16 +63,20 @@ int setUDPDestinationDetails(int iRxEntry, int index, const char *ip,
int err = getaddrinfo(udpDestinationIp[iRxEntry][index], sport, &hints,
&udpServerAddrInfo[iRxEntry][index]);
if (err != 0) {
- LOG(logERROR, ("Failed to resolve remote socket address %s at port %d [entry:%d]. "
+ LOG(logERROR, ("Failed to resolve remote socket address %s at port %d "
+ "[entry:%d]. "
"(Error code:%d, %s)\n",
- udpDestinationIp[iRxEntry][index], udpDestinationPort[iRxEntry][index], iRxEntry, err,
+ udpDestinationIp[iRxEntry][index],
+ udpDestinationPort[iRxEntry][index], iRxEntry, err,
gai_strerror(err)));
return FAIL;
}
if (udpServerAddrInfo[iRxEntry][index] == NULL) {
- LOG(logERROR, ("Failed to resolve remote socket address %s at port %d [entry:%d]."
- "(getaddrinfo returned NULL)\n",
- udpDestinationIp[iRxEntry][index], udpDestinationPort[iRxEntry][index], iRxEntry));
+ LOG(logERROR,
+ ("Failed to resolve remote socket address %s at port %d [entry:%d]."
+ "(getaddrinfo returned NULL)\n",
+ udpDestinationIp[iRxEntry][index],
+ udpDestinationPort[iRxEntry][index], iRxEntry));
udpServerAddrInfo[iRxEntry][index] = 0;
return FAIL;
}
@@ -78,41 +85,51 @@ int setUDPDestinationDetails(int iRxEntry, int index, const char *ip,
}
int createUDPSocket(int index) {
-
+
for (int iRxEntry = 0; iRxEntry != numUdpDestinations; ++iRxEntry) {
- LOG(logDEBUG2, ("Creating UDP Socket %d [entry:%d]\n", index, iRxEntry));
+ LOG(logDEBUG2,
+ ("Creating UDP Socket %d [entry:%d]\n", index, iRxEntry));
if (!strlen(udpDestinationIp[iRxEntry][index])) {
- LOG(logERROR, ("No destination UDP ip specified for socket %d [entry:%d].\n", index, iRxEntry));
+ LOG(logERROR,
+ ("No destination UDP ip specified for socket %d [entry:%d].\n",
+ index, iRxEntry));
return FAIL;
}
if (udpSockfd[iRxEntry][index] != -1) {
- LOG(logERROR, ("Strange that Udp socket was still open [socket:%d, entry:%d]. Closing it to "
- "create a new one.\n", index, iRxEntry));
+ LOG(logERROR, ("Strange that Udp socket was still open [socket:%d, "
+ "entry:%d]. Closing it to "
+ "create a new one.\n",
+ index, iRxEntry));
close(udpSockfd[iRxEntry][index]);
udpSockfd[iRxEntry][index] = -1;
}
// Creating socket file descriptor
- udpSockfd[iRxEntry][index] = socket(udpServerAddrInfo[iRxEntry][index]->ai_family,
- udpServerAddrInfo[iRxEntry][index]->ai_socktype,
- udpServerAddrInfo[iRxEntry][index]->ai_protocol);
+ udpSockfd[iRxEntry][index] =
+ socket(udpServerAddrInfo[iRxEntry][index]->ai_family,
+ udpServerAddrInfo[iRxEntry][index]->ai_socktype,
+ udpServerAddrInfo[iRxEntry][index]->ai_protocol);
if (udpSockfd[iRxEntry][index] == -1) {
- LOG(logERROR, ("UDP socket at port %d failed [entry:%d]. (Error code:%d, %s)\n",
- udpDestinationPort[iRxEntry][index], iRxEntry, errno, gai_strerror(errno)));
+ LOG(logERROR, ("UDP socket at port %d failed [entry:%d]. (Error "
+ "code:%d, %s)\n",
+ udpDestinationPort[iRxEntry][index], iRxEntry, errno,
+ gai_strerror(errno)));
return FAIL;
}
- LOG(logINFO, ("Udp client socket created for server (entry:%d, port %d, ip:%s)\n",
- iRxEntry, udpDestinationPort[iRxEntry][index], udpDestinationIp[iRxEntry][index]));
-
- // Using connect expects that the receiver (udp server) exists to listen to
- // these packets connecting allows to use "send/write" instead of "sendto",
- // avoiding checking for server address for each packet using write without
- // a connect will end in segv
- LOG(logINFO, ("Udp client socket connected [%d, %d, %s]\n", iRxEntry, udpDestinationPort[iRxEntry][index],
- udpDestinationIp[iRxEntry][index]));
+ LOG(logINFO, ("Udp client socket created for server (entry:%d, port "
+ "%d, ip:%s)\n",
+ iRxEntry, udpDestinationPort[iRxEntry][index],
+ udpDestinationIp[iRxEntry][index]));
+ // Using connect expects that the receiver (udp server) exists to listen
+ // to these packets connecting allows to use "send/write" instead of
+ // "sendto", avoiding checking for server address for each packet using
+ // write without a connect will end in segv
+ LOG(logINFO, ("Udp client socket connected [%d, %d, %s]\n", iRxEntry,
+ udpDestinationPort[iRxEntry][index],
+ udpDestinationIp[iRxEntry][index]));
}
return OK;
}
@@ -123,9 +140,9 @@ int sendUDPPacket(int iRxEntry, int index, const char *buf, int length) {
udpServerAddrInfo[iRxEntry][index]->ai_addrlen);
// udp sends atomically, no need to handle partial data
if (n == -1) {
- LOG(logERROR,
- ("Could not send udp packet for socket %d [entry:%d]. (Error code:%d, %s)\n",
- index, iRxEntry, errno, gai_strerror(errno)));
+ LOG(logERROR, ("Could not send udp packet for socket %d [entry:%d]. "
+ "(Error code:%d, %s)\n",
+ index, iRxEntry, errno, gai_strerror(errno)));
} else {
LOG(logDEBUG2, ("%d bytes sent\n", n));
}
diff --git a/slsDetectorServers/slsDetectorServer/src/loadPattern.c b/slsDetectorServers/slsDetectorServer/src/loadPattern.c
index 0a360a10d..6465ac73b 100644
--- a/slsDetectorServers/slsDetectorServer/src/loadPattern.c
+++ b/slsDetectorServers/slsDetectorServer/src/loadPattern.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "loadPattern.h"
#include "RegisterDefs.h"
#include "common.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/nios.c b/slsDetectorServers/slsDetectorServer/src/nios.c
index 27de69d7b..03c9f364a 100644
--- a/slsDetectorServers/slsDetectorServer/src/nios.c
+++ b/slsDetectorServers/slsDetectorServer/src/nios.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "nios.h"
#include "RegisterDefs.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c b/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c
index bd8b4a6b6..bfbe08b28 100644
--- a/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c
+++ b/slsDetectorServers/slsDetectorServer/src/programFpgaBlackfin.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "programFpgaBlackfin.h"
#include "clogger.h"
#include "common.h"
@@ -5,8 +7,8 @@
#include "slsDetectorServer_defs.h"
#include
-#include // usleep
#include
+#include // usleep
/* global variables */
// clang-format off
@@ -16,7 +18,7 @@
#define FLASH_BUFFER_MEMORY_SIZE (128 * 1024) // 500 KB
// clang-format on
-#define FLASH_DRIVE_NAME_SIZE 16
+#define FLASH_DRIVE_NAME_SIZE 16
char flashDriveName[FLASH_DRIVE_NAME_SIZE] = {0};
int gpioDefined = 0;
@@ -69,16 +71,25 @@ void resetFPGA() {
int deleteOldFile(char *mess) {
char cmd[MAX_STR_LENGTH] = {0};
char retvals[MAX_STR_LENGTH] = {0};
- sprintf(cmd, "rm -fr %s", TEMP_PROG_FILE_NAME);
- if (FAIL == executeCommand(cmd, retvals, logDEBUG1)) {
- strcpy(mess,
- "Could not program fpga. (could not delete old file: ");
- strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
- strcat(mess, "\n");
+
+ char *format = "rm -fr %s";
+ if (snprintf(cmd, MAX_STR_LENGTH, format, TEMP_PROG_FILE_NAME) >=
+ MAX_STR_LENGTH) {
+ strcpy(
+ mess,
+ "Could not program fpga. Command to delete old file is too long\n");
LOG(logERROR, (mess));
return FAIL;
}
- LOG(logINFO, ("\tDeleted old programming file (%s)\n", TEMP_PROG_FILE_NAME));
+ if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
+ snprintf(mess, MAX_STR_LENGTH,
+ "Could not program fpga. (could not delete old file: %s)\n",
+ retvals);
+ // LOG(logERROR, (mess)); already printed in executecommand
+ return FAIL;
+ }
+ LOG(logINFO,
+ ("\tDeleted old programming file (%s)\n", TEMP_PROG_FILE_NAME));
return OK;
}
@@ -140,12 +151,11 @@ int copyToFlash(ssize_t fsize, char *clientChecksum, char *mess) {
return FAIL;
}
-/* ignoring this until a consistent way to read from bfin flash
- if (verifyChecksumFromFlash(mess, clientChecksum, flashDriveName, fsize) ==
- FAIL) {
- return FAIL;
- }
-*/
+ /* ignoring this until a consistent way to read from bfin flash
+ if (verifyChecksumFromFlash(mess, clientChecksum, flashDriveName, fsize)
+ == FAIL) { return FAIL;
+ }
+ */
if (waitForFPGAtoTouchFlash(mess) == FAIL) {
return FAIL;
}
@@ -169,12 +179,13 @@ int getDrive(char *mess) {
char cmd[MAX_STR_LENGTH] = {0};
char retvals[MAX_STR_LENGTH] = {0};
+
strcpy(cmd, CMD_GET_FLASH);
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
- strcpy(mess, "Could not program fpga. (could not get flash drive: ");
- strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
- strcat(mess, "\n");
- LOG(logERROR, (mess));
+ snprintf(mess, MAX_STR_LENGTH,
+ "Could not program fpga. (could not get flash drive: %s)\n",
+ retvals);
+ // LOG(logERROR, (mess)); already printed in executecommand
return FAIL;
}
@@ -228,15 +239,21 @@ int eraseFlash(char *mess) {
#endif
char cmd[MAX_STR_LENGTH] = {0};
char retvals[MAX_STR_LENGTH] = {0};
- sprintf(cmd, "flash_eraseall %s", flashDriveName);
- if (FAIL == executeCommand(cmd, retvals, logDEBUG1)) {
- strcpy(mess, "Could not program fpga. (could not erase flash: ");
- strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
- strcat(mess, "\n");
+ char *format = "flash_eraseall %s";
+ if (snprintf(cmd, MAX_STR_LENGTH, format, flashDriveName) >=
+ MAX_STR_LENGTH) {
+ strcpy(mess,
+ "Could not program fpga. Command to erase flash is too long\n");
LOG(logERROR, (mess));
return FAIL;
}
-
+ if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
+ snprintf(mess, MAX_STR_LENGTH,
+ "Could not program fpga. (could not erase flash: %s)\n",
+ retvals);
+ // LOG(logERROR, (mess)); already printed in executecommand
+ return FAIL;
+ }
LOG(logINFO, ("\tFlash erased\n"));
return OK;
}
@@ -244,8 +261,7 @@ int eraseFlash(char *mess) {
int writeToFlash(ssize_t fsize, FILE *flashfd, FILE *srcfd, char *mess) {
LOG(logDEBUG1, ("writing to flash\n"));
-
- char* buffer = malloc(FLASH_BUFFER_MEMORY_SIZE);
+ char *buffer = malloc(FLASH_BUFFER_MEMORY_SIZE);
if (buffer == NULL) {
fclose(flashfd);
fclose(srcfd);
@@ -258,12 +274,13 @@ int writeToFlash(ssize_t fsize, FILE *flashfd, FILE *srcfd, char *mess) {
int oldProgress = 0;
ssize_t totalBytes = 0;
- ssize_t bytes = fread((void*)buffer, sizeof(char), FLASH_BUFFER_MEMORY_SIZE, srcfd);
+ ssize_t bytes =
+ fread((void *)buffer, sizeof(char), FLASH_BUFFER_MEMORY_SIZE, srcfd);
while (bytes > 0) {
ssize_t bytesWritten =
- fwrite((void*)buffer, sizeof(char), bytes, flashfd);
+ fwrite((void *)buffer, sizeof(char), bytes, flashfd);
totalBytes += bytesWritten;
if (bytesWritten != bytes) {
@@ -287,9 +304,11 @@ int writeToFlash(ssize_t fsize, FILE *flashfd, FILE *srcfd, char *mess) {
fflush(stdout);
oldProgress = progress;
}
- } else printf(".");
+ } else
+ printf(".");
- bytes = fread((void*)buffer, sizeof(char), FLASH_BUFFER_MEMORY_SIZE, srcfd);
+ bytes = fread((void *)buffer, sizeof(char), FLASH_BUFFER_MEMORY_SIZE,
+ srcfd);
}
if (fsize <= 0) {
printf("\n");
@@ -300,15 +319,18 @@ int writeToFlash(ssize_t fsize, FILE *flashfd, FILE *srcfd, char *mess) {
LOG(logINFO, ("\tWrote %ld bytes to flash\n", totalBytes));
if (totalBytes != fsize) {
- sprintf(mess, "Could not program fpga. Incorrect bytes written to flash %lu [expected: %lu]\n", totalBytes, fsize);
+ sprintf(mess,
+ "Could not program fpga. Incorrect bytes written to flash %lu "
+ "[expected: %lu]\n",
+ totalBytes, fsize);
LOG(logERROR, (mess));
- return FAIL;
+ return FAIL;
}
return OK;
}
-int waitForFPGAtoTouchFlash(char* mess) {
- // touch and program
+int waitForFPGAtoTouchFlash(char *mess) {
+ // touch and program
FPGATouchFlash();
#ifdef VIRTUAL
@@ -316,36 +338,41 @@ int waitForFPGAtoTouchFlash(char* mess) {
#endif
LOG(logINFO, ("\tWaiting for FPGA to program from flash\n"));
int timeSpent = 0;
-
+
int result = 0;
while (result == 0) {
// time taken for fpga to pick up from flash
usleep(1000);
timeSpent += 1000;
if (timeSpent >= MAX_TIME_FPGA_TOUCH_FLASH_US) {
- sprintf(mess, "Could not program fpga. (exceeded max time allowed: %ds)\n",
- MAX_TIME_FPGA_TOUCH_FLASH_US/(1000 * 1000));
+ sprintf(
+ mess,
+ "Could not program fpga. (exceeded max time allowed: %ds)\n",
+ MAX_TIME_FPGA_TOUCH_FLASH_US / (1000 * 1000));
LOG(logERROR, (mess));
return FAIL;
}
- // read gpio status
+ // read gpio status
char retvals[MAX_STR_LENGTH] = {0};
- if (FAIL == executeCommand(CMD_FPGA_PICKED_STATUS, retvals, logDEBUG1)) {
- strcpy(mess,
- "Could not program fpga. (could not read gpio status: ");
- strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
- strcat(mess, "\n");
- LOG(logERROR, (mess));
+ if (FAIL ==
+ executeCommand(CMD_FPGA_PICKED_STATUS, retvals, logDEBUG1)) {
+ snprintf(
+ mess, MAX_STR_LENGTH,
+ "Could not program fpga. (could not read gpio status: %s)\n",
+ retvals);
+ // LOG(logERROR, (mess)); already printed in executecommand
return FAIL;
}
// convert to int
if (sscanf(retvals, "%d\n", &result) != 1) {
- sprintf(mess, "Could not program fpga. (could not scan int for gpio status: [%s])\n",
- retvals);
+ snprintf(mess, MAX_STR_LENGTH,
+ "Could not program fpga. (could not scan int for gpio "
+ "status: [%s])\n",
+ retvals);
LOG(logERROR, (mess));
- return FAIL;
+ return FAIL;
}
LOG(logDEBUG1, ("gpi07 returned %d\n", result));
}
diff --git a/slsDetectorServers/slsDetectorServer/src/programFpgaNios.c b/slsDetectorServers/slsDetectorServer/src/programFpgaNios.c
index 08dbe4f13..c82685224 100644
--- a/slsDetectorServers/slsDetectorServer/src/programFpgaNios.c
+++ b/slsDetectorServers/slsDetectorServer/src/programFpgaNios.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "programFpgaNios.h"
#include "clogger.h"
#include "common.h"
@@ -9,9 +11,9 @@
/* global variables */
-#define CMD_GET_FLASH "awk \'$5== \"Application\" {print $1}\' /proc/mtd"
+#define CMD_GET_FLASH "awk \'$5== \"Application\" {print $1}\' /proc/mtd"
-#define FLASH_DRIVE_NAME_SIZE 16
+#define FLASH_DRIVE_NAME_SIZE 16
char flashDriveName[FLASH_DRIVE_NAME_SIZE] = {0};
#define MICROCONTROLLER_FILE "/dev/ttyAL0"
@@ -49,7 +51,7 @@ int eraseAndWriteToFlash(char *mess, char *checksum, char *fpgasrc,
return FAIL;
}
- if (eraseFlash(mess) == FAIL) {
+ if (eraseFlash(mess) == FAIL) {
fclose(flashfd);
return FAIL;
}
@@ -86,10 +88,10 @@ int getDrive(char *mess) {
char retvals[MAX_STR_LENGTH] = {0};
strcpy(cmd, CMD_GET_FLASH);
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
- strcpy(mess, "Could not program fpga. (could not get flash drive: ");
- strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
- strcat(mess, "\n");
- LOG(logERROR, (mess));
+ snprintf(mess, MAX_STR_LENGTH,
+ "Could not program fpga. (could not get flash drive: %s)\n",
+ retvals);
+ // LOG(logERROR, (mess)); already printed in executecommand
return FAIL;
}
@@ -127,14 +129,22 @@ int eraseFlash(char *mess) {
#endif
char cmd[MAX_STR_LENGTH] = {0};
char retvals[MAX_STR_LENGTH] = {0};
- sprintf(cmd, "flash_erase %s 0 0", flashDriveName);
- if (FAIL == executeCommand(cmd, retvals, logDEBUG1)) {
- strcpy(mess, "Could not program fpga. (could not erase flash: ");
- strncat(mess, retvals, sizeof(mess) - strlen(mess) - 1);
- strcat(mess, "\n");
+
+ char *format = "flash_erase %s 0 0";
+ if (snprintf(cmd, MAX_STR_LENGTH, format, flashDriveName) >=
+ MAX_STR_LENGTH) {
+ strcpy(mess,
+ "Could not program fpga. Command to erase flash is too long\n");
LOG(logERROR, (mess));
return FAIL;
}
+ if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
+ snprintf(mess, MAX_STR_LENGTH,
+ "Could not program fpga. (could not erase flash: %s)\n",
+ retvals);
+ // LOG(logERROR, (mess)); already printed in executecommand
+ return FAIL;
+ }
LOG(logINFO, ("\tFlash erased\n"));
return OK;
@@ -146,10 +156,10 @@ int writeToFlash(ssize_t fsize, FILE *flashfd, char *buffer, char *mess) {
ssize_t bytesWritten = fwrite((void *)buffer, sizeof(char), fsize, flashfd);
if (bytesWritten != fsize) {
fclose(flashfd);
- sprintf(
- mess,
- "Could not program fpga. Incorrect bytes written to flash %lu [expected: %lu]\n",
- (long int)bytesWritten, (long int)fsize);
+ sprintf(mess,
+ "Could not program fpga. Incorrect bytes written to flash %lu "
+ "[expected: %lu]\n",
+ (long int)bytesWritten, (long int)fsize);
LOG(logERROR, (mess));
return FAIL;
}
diff --git a/slsDetectorServers/slsDetectorServer/src/sharedMemory.c b/slsDetectorServers/slsDetectorServer/src/sharedMemory.c
index 42b49683c..ce4bee979 100644
--- a/slsDetectorServers/slsDetectorServer/src/sharedMemory.c
+++ b/slsDetectorServers/slsDetectorServer/src/sharedMemory.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "sharedMemory.h"
#include "clogger.h"
diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c
index 87acd4693..7b633e4d1 100644
--- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c
+++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
/* A simple server in the internet domain using TCP
The port number is passed as an argument */
diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c
index 5c724b10e..1c6299153 100644
--- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c
+++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "slsDetectorServer_funcs.h"
#include "clogger.h"
#include "communication_funcs.h"
@@ -13,8 +15,8 @@
#include
#include
#include
-#include
#include
+#include
// defined in the detector specific Makefile
#ifdef GOTTHARDD
@@ -89,7 +91,7 @@ void init_detector() {
udpDetails[0].dstport = DEFAULT_UDP_DST_PORTNO;
#ifdef EIGERD
udpDetails[0].dstport2 = DEFAULT_UDP_DST_PORTNO + 1;
-#endif
+#endif
if (isControlServer) {
basictests();
@@ -410,7 +412,8 @@ void function_table() {
flist[F_CLEAR_ALL_UDP_DEST] = &clear_all_udp_dst;
flist[F_GET_UDP_FIRST_DEST] = &get_udp_first_dest;
flist[F_SET_UDP_FIRST_DEST] = &set_udp_first_dest;
-
+ flist[F_GET_READOUT_SPEED] = &get_readout_speed;
+ flist[F_SET_READOUT_SPEED] = &set_readout_speed;
// check
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
LOG(logERROR, ("The last detector function enum has reached its "
@@ -445,7 +448,7 @@ int executeCommand(char *command, char *result, enum TLogLevel level) {
memset(result, 0, MAX_STR_LENGTH);
// copy command
- char cmd[MAX_STR_LENGTH]= {0};
+ char cmd[MAX_STR_LENGTH] = {0};
sprintf(cmd, "%s 2>&1", command);
LOG(level, ("Executing command:\n[%s]\n", cmd));
@@ -1057,7 +1060,7 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
ret = AD9257_SetVrefVoltage(val, mV);
if (ret == FAIL) {
sprintf(mess, "Could not set Adc Vpp. Please set a "
- "proper value\n");
+ "proper value\n");
LOG(logERROR, (mess));
}
}
@@ -1083,14 +1086,14 @@ int validateAndSetDac(enum dacIndex ind, int val, int mV) {
retval = setHighVoltage(val);
LOG(logDEBUG1, ("High Voltage: %d\n", retval));
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || \
-defined(GOTTHARD2D) || defined(MYTHEN3D)
+ defined(GOTTHARD2D) || defined(MYTHEN3D)
validate(&ret, mess, val, retval, "set high voltage", DEC);
#endif
#ifdef GOTTHARDD
if (retval == -1) {
ret = FAIL;
strcpy(mess, "Invalid Voltage. Valid values are 0, 90, "
- "110, 120, 150, 180, 200\n");
+ "110, 120, 150, 180, 200\n");
LOG(logERROR, (mess));
} else
validate(&ret, mess, val, retval, "set high voltage", DEC);
@@ -1104,10 +1107,10 @@ defined(GOTTHARD2D) || defined(MYTHEN3D)
val);
else if (retval == -2)
strcpy(mess, "Setting high voltage failed. "
- "Serial/i2c communication failed.\n");
+ "Serial/i2c communication failed.\n");
else if (retval == -3)
strcpy(mess, "Getting high voltage failed. "
- "Serial/i2c communication failed.\n");
+ "Serial/i2c communication failed.\n");
LOG(logERROR, (mess));
}
#endif
@@ -1137,13 +1140,13 @@ defined(GOTTHARD2D) || defined(MYTHEN3D)
LOG(logERROR, (mess));
} else if (!isPowerValid(serverDacIndex, val)) {
ret = FAIL;
- sprintf(mess,
- "Could not set power. Power regulator %d "
- "should be between %d and %d mV\n",
- ind,
- (serverDacIndex == D_PWR_IO ? VIO_MIN_MV
- : POWER_RGLTR_MIN),
- (VCHIP_MAX_MV - VCHIP_POWER_INCRMNT));
+ sprintf(
+ mess,
+ "Could not set power. Power regulator %d "
+ "should be between %d and %d mV\n",
+ ind,
+ (serverDacIndex == D_PWR_IO ? VIO_MIN_MV : POWER_RGLTR_MIN),
+ (VCHIP_MAX_MV - VCHIP_POWER_INCRMNT));
LOG(logERROR, (mess));
} else {
setPower(serverDacIndex, val);
@@ -1158,8 +1161,8 @@ defined(GOTTHARD2D) || defined(MYTHEN3D)
if (val >= 0) {
ret = FAIL;
sprintf(mess, "Can not set Vchip. Can only be set "
- "automatically in the background (+200mV "
- "from highest power regulator voltage).\n");
+ "automatically in the background (+200mV "
+ "from highest power regulator voltage).\n");
LOG(logERROR, (mess));
/* restrict users from setting vchip
if (!mV) {
@@ -1189,7 +1192,7 @@ defined(GOTTHARD2D) || defined(MYTHEN3D)
if (!mV) {
ret = FAIL;
strcpy(mess, "Could not set power. VLimit should be in "
- "mV and not dac units.\n");
+ "mV and not dac units.\n");
LOG(logERROR, (mess));
} else {
setVLimit(val);
@@ -1218,10 +1221,9 @@ defined(GOTTHARD2D) || defined(MYTHEN3D)
LOG(logERROR, (mess));
} else {
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
- if ((val != GET_FLAG && mV &&
- checkVLimitCompliant(val) == FAIL) ||
+ if ((val != GET_FLAG && mV && checkVLimitCompliant(val) == FAIL) ||
(val != GET_FLAG && !mV &&
- checkVLimitDacCompliant(val) == FAIL)) {
+ checkVLimitDacCompliant(val) == FAIL)) {
ret = FAIL;
sprintf(mess,
"Could not set dac %d to value %d. "
@@ -1245,7 +1247,7 @@ defined(GOTTHARD2D) || defined(MYTHEN3D)
case E_VCP:
setSettings(UNDEFINED);
LOG(logERROR, ("Settings has been changed "
- "to undefined (changed specific dacs)\n"));
+ "to undefined (changed specific dacs)\n"));
break;
default:
break;
@@ -1597,34 +1599,34 @@ void validate_settings(enum detectorSettings sett) {
case GAIN0:
case HIGHGAIN0:
#elif GOTTHARDD
- case DYNAMICGAIN:
- case HIGHGAIN:
- case LOWGAIN:
- case MEDIUMGAIN:
- case VERYHIGHGAIN:
+ case DYNAMICGAIN:
+ case HIGHGAIN:
+ case LOWGAIN:
+ case MEDIUMGAIN:
+ case VERYHIGHGAIN:
#elif GOTTHARD2D
- case DYNAMICGAIN:
- case FIXGAIN1:
- case FIXGAIN2:
+ case DYNAMICGAIN:
+ case FIXGAIN1:
+ case FIXGAIN2:
#elif MOENCHD
- case G1_HIGHGAIN:
- case G1_LOWGAIN:
- case G2_HIGHCAP_HIGHGAIN:
- case G2_HIGHCAP_LOWGAIN:
- case G2_LOWCAP_HIGHGAIN:
- case G2_LOWCAP_LOWGAIN:
- case G4_HIGHGAIN:
- case G4_LOWGAIN:
+ case G1_HIGHGAIN:
+ case G1_LOWGAIN:
+ case G2_HIGHCAP_HIGHGAIN:
+ case G2_HIGHCAP_LOWGAIN:
+ case G2_LOWCAP_HIGHGAIN:
+ case G2_LOWCAP_LOWGAIN:
+ case G4_HIGHGAIN:
+ case G4_LOWGAIN:
#elif MYTHEN3D
- case STANDARD:
- case FAST:
- case HIGHGAIN:
+ case STANDARD:
+ case FAST:
+ case HIGHGAIN:
#endif
- break;
- default:
- modeNotImplemented("Settings Index", (int)sett);
- break;
- }
+ break;
+ default:
+ modeNotImplemented("Settings Index", (int)sett);
+ break;
+ }
}
int set_settings(int file_des) {
@@ -1716,16 +1718,16 @@ int acquire(int blocking, int file_des) {
// only set
if (Server_VerifyLock() == OK) {
#ifdef JUNGFRAUD
- // chipv1.1 has to be configured before acquisition
- if (getChipVersion() == 11 && !isChipConfigured()) {
+ // chipv1.1 has to be configured before acquisition
+ if (getChipVersion() == 11 && !isChipConfigured()) {
ret = FAIL;
strcpy(mess, "Could not start acquisition. Chip is not configured. "
"Power it on to configure it.\n");
LOG(logERROR, (mess));
- } else
+ } else
#endif
#ifdef MOENCHD
- if (getNumAnalogSamples() <= 0) {
+ if (getNumAnalogSamples() <= 0) {
ret = FAIL;
sprintf(mess,
"Could not start acquisition. Invalid number of analog "
@@ -2075,7 +2077,8 @@ int set_num_additional_storage_cells(int file_des) {
if (Server_VerifyLock() == OK) {
if (getChipVersion() == 11) {
ret = FAIL;
- sprintf(mess, "Cannot set addl. number of storage cells for chip v1.1\n");
+ sprintf(mess,
+ "Cannot set addl. number of storage cells for chip v1.1\n");
LOG(logERROR, (mess));
} else if (arg > getMaxStoragecellStart()) {
ret = FAIL;
@@ -2531,7 +2534,7 @@ int get_storage_cell_delay(int file_des) {
} else {
retval = getStorageCellDelay();
LOG(logDEBUG1,
- ("retval storage cell delay %lld ns\n", (long long int)retval));
+ ("retval storage cell delay %lld ns\n", (long long int)retval));
}
#endif
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
@@ -2554,7 +2557,8 @@ int set_storage_cell_delay(int file_des) {
if (Server_VerifyLock() == OK) {
if (getChipVersion() == 11) {
ret = FAIL;
- strcpy(mess, "Storage cell delay is not applicable for chipv 1.1\n");
+ strcpy(mess,
+ "Storage cell delay is not applicable for chipv 1.1\n");
LOG(logERROR, (mess));
} else if (arg > MAX_STORAGE_CELL_DLY_NS_VAL) {
ret = FAIL;
@@ -3699,7 +3703,10 @@ int program_fpga(int file_des) {
fclose(fd);
struct sysinfo info;
sysinfo(&info);
- sprintf(mess, "Could not allocate memory to get fpga program. Free space: %d MB\n", (int)(info.freeram/ (1024 * 1024)));
+ sprintf(mess,
+ "Could not allocate memory to get fpga program. Free "
+ "space: %d MB\n",
+ (int)(info.freeram / (1024 * 1024)));
LOG(logERROR, (mess));
ret = FAIL;
}
@@ -3732,7 +3739,7 @@ int program_fpga(int file_des) {
// unitprogramsize++;
} else
filesize -= unitprogramsize;
-
+
// copy program
if (fwrite((void *)src, sizeof(char), unitprogramsize, fd) !=
unitprogramsize) {
@@ -3756,8 +3763,7 @@ int program_fpga(int file_des) {
// checksum of copied program
if (ret == OK) {
- ret =
- verifyChecksumFromFile(mess, checksum, TEMP_PROG_FILE_NAME);
+ ret = verifyChecksumFromFile(mess, checksum, TEMP_PROG_FILE_NAME);
}
Server_SendResult(file_des, INT32, NULL, 0);
if (ret == FAIL) {
@@ -3770,7 +3776,7 @@ int program_fpga(int file_des) {
Server_SendResult(file_des, INT32, NULL, 0);
if (ret == FAIL) {
LOG(logERROR, ("Program FPGA FAIL!\n"));
- return FAIL;
+ return FAIL;
}
#endif // end of Blackfin programming
@@ -4024,7 +4030,8 @@ int storage_cell_start(int file_des) {
if ((arg == GET_FLAG) || (Server_VerifyLock() == OK)) {
if (arg > getMaxStoragecellStart()) {
ret = FAIL;
- sprintf(mess, "Max Storage cell number should not exceed %d\n", getMaxStoragecellStart());
+ sprintf(mess, "Max Storage cell number should not exceed %d\n",
+ getMaxStoragecellStart());
LOG(logERROR, (mess));
} else {
retval = selectStoragecellStart(arg);
@@ -4207,7 +4214,7 @@ int copy_detector_server(int file_des) {
if (receiveData(file_des, args, sizeof(args), OTHER) < 0)
return printSocketReadError();
-#ifdef EIGERD
+#ifdef VIRTUAL
functionNotImplemented();
#else
@@ -4216,57 +4223,114 @@ int copy_detector_server(int file_des) {
char *sname = args[0];
char *hostname = args[1];
LOG(logINFOBLUE, ("Copying server %s from host %s\n", sname, hostname));
+ char cmd[MAX_STR_LENGTH] = {0};
- char cmd[MAX_STR_LENGTH];
- memset(cmd, 0, MAX_STR_LENGTH);
-
- // copy server
- strcpy(cmd, "tftp ");
- strcat(cmd, hostname);
- strcat(cmd, " -r ");
- strcat(cmd, sname);
- strcat(cmd, " -g");
- int success = executeCommand(cmd, retvals, logDEBUG1);
- if (success == FAIL) {
+ // tftp server
+ char *format = "tftp %s -r %s -g";
+ if (snprintf(cmd, MAX_STR_LENGTH, format, hostname, sname) >=
+ MAX_STR_LENGTH) {
ret = FAIL;
- strcpy(mess, retvals);
+ strcpy(mess, "Could not copy detector server. Command to copy "
+ "server too long\n");
+ LOG(logERROR, (mess));
+ } else if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
+ ret = FAIL;
+ snprintf(mess, MAX_STR_LENGTH,
+ "Could not copy detector server (tftp). %s\n", retvals);
// LOG(logERROR, (mess)); already printed in executecommand
+ } else {
+ LOG(logINFO, ("\tServer copied\n"));
}
- // success
- else {
- LOG(logINFO, ("Server copied successfully\n"));
- // give permissions
- strcpy(cmd, "chmod 777 ");
- strcat(cmd, sname);
- executeCommand(cmd, retvals, logDEBUG1);
-
-#if !defined(GOTTHARD2D) && !defined(MYTHEN3D)
- // edit /etc/inittab
- // find line numbers in /etc/inittab where DetectorServer
- strcpy(cmd, "sed -n '/DetectorServer/=' /etc/inittab");
- executeCommand(cmd, retvals, logDEBUG1);
- while (strlen(retvals)) {
- // get first linen number
- int lineNumber = atoi(retvals);
- // delete that line
- sprintf(cmd, "sed -i \'%dd\' /etc/inittab", lineNumber);
- executeCommand(cmd, retvals, logDEBUG1);
- // find line numbers again
- strcpy(cmd, "sed -n '/DetectorServer/=' /etc/inittab");
- executeCommand(cmd, retvals, logDEBUG1);
+ // give permissions
+ if (ret == OK) {
+ if (snprintf(cmd, MAX_STR_LENGTH, "chmod 777 %s", sname) >=
+ MAX_STR_LENGTH) {
+ ret = FAIL;
+ strcpy(mess, "Could not copy detector server. Command to give "
+ "permissions to server is too long\n");
+ LOG(logERROR, (mess));
+ } else if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
+ ret = FAIL;
+ snprintf(mess, MAX_STR_LENGTH,
+ "Could not copy detector server (permissions). %s\n",
+ retvals);
+ // LOG(logERROR, (mess)); already printed in executecommand
+ } else {
+ LOG(logINFO, ("\tPermissions modified\n"));
}
- LOG(logINFO, ("Deleted all lines containing DetectorServer in "
- "/etc/inittab\n"));
+ }
- // append line
- strcpy(cmd, "echo \"ttyS0::respawn:/./");
- strcat(cmd, sname);
- strcat(cmd, "\" >> /etc/inittab");
- executeCommand(cmd, retvals, logDEBUG1);
+ // symbolic link
+ if (ret == OK) {
+ if (snprintf(cmd, MAX_STR_LENGTH, "ln -sf %s %s", sname,
+ LINKED_SERVER_NAME) >= MAX_STR_LENGTH) {
+ ret = FAIL;
+ strcpy(mess, "Could not copy detector server. Command to "
+ "create symbolic link too long\n");
+ LOG(logERROR, (mess));
+ } else if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
+ ret = FAIL;
+ snprintf(mess, MAX_STR_LENGTH,
+ "Could not copy detector server (symbolic link). %s\n",
+ retvals);
+ // LOG(logERROR, (mess)); already printed in executecommand
+ } else {
+ LOG(logINFO, ("\tSymbolic link created\n"));
+ }
+ }
- LOG(logINFO, ("/etc/inittab modified to have %s\n", sname));
+ // blackfin boards (respawn) (only kept for backwards compatibility)
+#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || \
+ defined(GOTTHARDD)
+ // delete every line with DetectorServer in /etc/inittab
+ if (ret == OK) {
+ strcpy(cmd, "sed -i '/DetectorServer/d' /etc/inittab");
+ if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
+ ret = FAIL;
+ snprintf(
+ mess, MAX_STR_LENGTH,
+ "Could not copy detector server (del respawning). %s\n",
+ retvals);
+ // LOG(logERROR, (mess)); already printed in executecommand
+ } else {
+ LOG(logINFO, ("\tinittab: DetectoServer line deleted\n"));
+ }
+ }
+
+ // add new link name to /etc/inittab
+ if (ret == OK) {
+ format = "echo 'ttyS0::respawn:/./%s' >> /etc/inittab";
+ if (snprintf(cmd, MAX_STR_LENGTH, format, LINKED_SERVER_NAME) >=
+ MAX_STR_LENGTH) {
+ ret = FAIL;
+ strcpy(mess, "Could not copy detector server. Command "
+ "to add new server for spawning is too long\n");
+ LOG(logERROR, (mess));
+ } else if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
+ ret = FAIL;
+ snprintf(mess, MAX_STR_LENGTH,
+ "Could not copy detector server (respawning). %s\n",
+ retvals);
+ // LOG(logERROR, (mess)); already printed in executecommand
+ } else {
+ LOG(logINFO, ("\tinittab: updated for respawning\n"));
+ }
+ }
#endif
+
+ // sync
+ if (ret == OK) {
+ strcpy(cmd, "sync");
+ if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
+ ret = FAIL;
+ snprintf(mess, MAX_STR_LENGTH,
+ "Could not copy detector server (sync). %s\n",
+ retvals);
+ // LOG(logERROR, (mess)); already printed in executecommand
+ } else {
+ LOG(logINFO, ("\tsync\n"));
+ }
}
}
#endif
@@ -4753,14 +4817,15 @@ int set_read_n_rows(int file_des) {
LOG(logERROR, (mess));
} else
#elif JUNGFRAUD
- if ((check_detector_idle("set number of rows") == OK) && (arg % READ_N_ROWS_MULTIPLE != 0)) {
+ if ((check_detector_idle("set number of rows") == OK) &&
+ (arg % READ_N_ROWS_MULTIPLE != 0)) {
ret = FAIL;
sprintf(mess,
"Could not set number of rows. %d must be a multiple "
"of %d\n",
arg, READ_N_ROWS_MULTIPLE);
LOG(logERROR, (mess));
- } else
+ } else
#endif
{
if (setReadNRows(arg) == FAIL) {
@@ -4894,7 +4959,9 @@ int set_detector_position(int file_des) {
// only set
if (Server_VerifyLock() == OK) {
- if (check_detector_idle("configure mac") == OK) {
+ // if in update mode, there is no need to do this (also detector not set
+ // up)
+ if (!updateFlag && check_detector_idle("configure mac") == OK) {
maxydet = args[0];
detectorId = args[1];
calculate_and_set_position();
@@ -4920,44 +4987,52 @@ int check_detector_idle(const char *s) {
int is_udp_configured() {
for (int i = 0; i != numUdpDestinations; ++i) {
if (udpDetails[i].dstip == 0) {
- sprintf(configureMessage, "udp destination ip not configured [entry:%d]\n", i);
+ sprintf(configureMessage,
+ "udp destination ip not configured [entry:%d]\n", i);
LOG(logWARNING, ("%s", configureMessage));
return FAIL;
}
if (udpDetails[i].srcip == 0) {
- sprintf(configureMessage, "udp source ip not configured [entry:%d]\n", i);
+ sprintf(configureMessage,
+ "udp source ip not configured [entry:%d]\n", i);
LOG(logWARNING, ("%s", configureMessage));
return FAIL;
}
if (udpDetails[i].srcmac == 0) {
- sprintf(configureMessage, "udp source mac not configured [entry:%d]\n", i);
+ sprintf(configureMessage,
+ "udp source mac not configured [entry:%d]\n", i);
LOG(logWARNING, ("%s", configureMessage));
return FAIL;
}
if (udpDetails[i].dstmac == 0) {
- sprintf(configureMessage, "udp destination mac not configured [entry:%d]\n", i);
+ sprintf(configureMessage,
+ "udp destination mac not configured [entry:%d]\n", i);
LOG(logWARNING, ("%s", configureMessage));
return FAIL;
}
#if defined(JUNGFRAUD) || defined(GOTTHARD2D)
if (getNumberofUDPInterfaces() == 2) {
if (udpDetails[i].srcip2 == 0) {
- sprintf(configureMessage, "udp source ip2 not configured [entry:%d]\n", i);
+ sprintf(configureMessage,
+ "udp source ip2 not configured [entry:%d]\n", i);
LOG(logWARNING, ("%s", configureMessage));
return FAIL;
}
if (udpDetails[i].dstip2 == 0) {
- sprintf(configureMessage, "udp destination ip2 not configured [entry:%d]\n", i);
+ sprintf(configureMessage,
+ "udp destination ip2 not configured [entry:%d]\n", i);
LOG(logWARNING, ("%s", configureMessage));
return FAIL;
}
if (udpDetails[i].srcmac2 == 0) {
- sprintf(configureMessage, "udp source mac2 not configured [entry:%d]\n", i);
+ sprintf(configureMessage,
+ "udp source mac2 not configured [entry:%d]\n", i);
LOG(logWARNING, ("%s", configureMessage));
return FAIL;
}
if (udpDetails[i].dstmac2 == 0) {
- sprintf(configureMessage, "udp destination mac2 not configured [entry:%d]\n", i);
+ sprintf(configureMessage,
+ "udp destination mac2 not configured [entry:%d]\n", i);
LOG(logWARNING, ("%s", configureMessage));
return FAIL;
}
@@ -4968,25 +5043,28 @@ int is_udp_configured() {
}
void configure_mac() {
- if (is_udp_configured() == OK) {
- ret = configureMAC();
- if (ret != OK) {
+ if (isControlServer) {
+ if (is_udp_configured() == OK) {
+ ret = configureMAC();
+ if (ret != OK) {
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
- if (ret == -1) {
- sprintf(mess, "Could not allocate RAM\n");
- } else {
- sprintf(mess, "Could not configure mac because of incorrect "
- "udp 1G destination IP and port\n");
- }
+ if (ret == -1) {
+ sprintf(mess, "Could not allocate RAM\n");
+ } else {
+ sprintf(mess,
+ "Could not configure mac because of incorrect "
+ "udp 1G destination IP and port\n");
+ }
#else
- sprintf(mess, "Configure Mac failed\n");
+ sprintf(mess, "Configure Mac failed\n");
#endif
- strcpy(configureMessage, mess);
- LOG(logERROR, (mess));
- } else {
- LOG(logINFOGREEN, ("\tConfigure MAC successful\n"));
- configured = OK;
- return;
+ strcpy(configureMessage, mess);
+ LOG(logERROR, (mess));
+ } else {
+ LOG(logINFOGREEN, ("\tConfigure MAC successful\n"));
+ configured = OK;
+ return;
+ }
}
}
configured = FAIL;
@@ -5411,7 +5489,8 @@ int set_num_interfaces(int file_des) {
} else if (check_detector_idle("configure mac") == OK) {
if (getNumberofUDPInterfaces() != arg) {
setNumberofUDPInterfaces(arg);
- for (int iRxEntry = 0; iRxEntry != numUdpDestinations; ++iRxEntry) {
+ for (int iRxEntry = 0; iRxEntry != numUdpDestinations;
+ ++iRxEntry) {
if (arg == 1) {
udpDetails[iRxEntry].srcport2 = 0;
udpDetails[iRxEntry].srcip2 = 0;
@@ -5420,20 +5499,25 @@ int set_num_interfaces(int file_des) {
udpDetails[iRxEntry].dstip2 = 0;
udpDetails[iRxEntry].dstmac2 = 0;
} else {
- // if still 0, set defaults
- udpDetails[iRxEntry].srcport2 = DEFAULT_UDP_SRC_PORTNO + 1;
+ // if still 0, set defaults
+ udpDetails[iRxEntry].srcport2 =
+ DEFAULT_UDP_SRC_PORTNO + 1;
if (udpDetails[iRxEntry].dstport2 == 0) {
- udpDetails[iRxEntry].dstport2 = 2 * iRxEntry + 1 + DEFAULT_UDP_DST_PORTNO;
+ udpDetails[iRxEntry].dstport2 =
+ 2 * iRxEntry + 1 + DEFAULT_UDP_DST_PORTNO;
}
// if still 0, copy from entry 0
if (iRxEntry != 0) {
udpDetails[iRxEntry].srcip2 = udpDetails[0].srcip2;
- udpDetails[iRxEntry].srcmac2 = udpDetails[0].srcmac2;
+ udpDetails[iRxEntry].srcmac2 =
+ udpDetails[0].srcmac2;
if (udpDetails[iRxEntry].dstip2 == 0) {
- udpDetails[iRxEntry].dstip2 = udpDetails[0].dstip2;
+ udpDetails[iRxEntry].dstip2 =
+ udpDetails[0].dstip2;
}
if (udpDetails[iRxEntry].dstmac2 == 0) {
- udpDetails[iRxEntry].dstmac2 = udpDetails[0].dstmac2;
+ udpDetails[iRxEntry].dstmac2 =
+ udpDetails[0].dstmac2;
}
}
}
@@ -6010,46 +6094,22 @@ int set_clock_divider(int file_des) {
return printSocketReadError();
LOG(logDEBUG1, ("Setting clock (%d) divider: %u\n", args[0], args[1]));
-#if !defined(EIGERD) && !defined(JUNGFRAUD) && !defined(GOTTHARD2D) && \
- !defined(MYTHEN3D)
+#if !defined(GOTTHARD2D) && !defined(MYTHEN3D)
functionNotImplemented();
#else
// only set
if (Server_VerifyLock() == OK) {
- int ind = args[0];
- int val = args[1];
- enum CLKINDEX c = 0;
- switch (ind) {
- // specific clock index
-#if defined(EIGERD) || defined(JUNGFRAUD)
- case RUN_CLOCK:
- c = RUN_CLK;
- break;
-#endif
- default:
- // any clock index
-#if defined(GOTTHARD2D) || defined(MYTHEN3D)
- if (ind < NUM_CLOCKS) {
- c = (enum CLKINDEX)ind;
- break;
- }
-#endif
- modeNotImplemented("clock index (divider set)", ind);
- break;
+
+ if (args[0] >= NUM_CLOCKS) {
+ modeNotImplemented("clock index (divider set)", args[0]);
}
- // validate val range
- if (ret != FAIL) {
-#ifdef JUNGFRAUD
- if (val == (int)FULL_SPEED && isHardwareVersion2()) {
- ret = FAIL;
- strcpy(mess,
- "Full speed not implemented for this board version.\n");
- LOG(logERROR, (mess));
- } else
-#endif
-#if defined(GOTTHARD2D) || defined(MYTHEN3D)
- if (val < 2 || val > getMaxClockDivider()) {
+ enum CLKINDEX c = 0;
+ int val = args[1];
+ if (ret == OK) {
+ c = (enum CLKINDEX)args[0];
+ // validate val range
+ if (val < 2 || val > getMaxClockDivider()) {
char *clock_names[] = {CLK_NAMES};
ret = FAIL;
sprintf(mess,
@@ -6058,24 +6118,12 @@ int set_clock_divider(int file_des) {
clock_names[c], (int)c, val, getMaxClockDivider());
LOG(logERROR, (mess));
}
-#else
- if (val < (int)FULL_SPEED || val > (int)QUARTER_SPEED) {
- ret = FAIL;
- sprintf(mess,
- "Cannot set speed to %d. Value should be in range "
- "[%d-%d]\n",
- val, (int)FULL_SPEED, (int)QUARTER_SPEED);
- LOG(logERROR, (mess));
- }
-#endif
}
if (ret != FAIL) {
- char modeName[50] = "speed";
-#if defined(GOTTHARD2D) || defined(MYTHEN3D)
+ char modeName[50];
char *clock_names[] = {CLK_NAMES};
sprintf(modeName, "%s clock (%d) divider", clock_names[c], (int)c);
-#endif
if (getClockDivider(c) == val) {
LOG(logINFO, ("Same %s: %d\n", modeName, val));
} else {
@@ -6105,29 +6153,15 @@ int get_clock_divider(int file_des) {
return printSocketReadError();
LOG(logDEBUG1, ("Getting clock (%d) divider\n", arg));
-#if !defined(EIGERD) && !defined(JUNGFRAUD) && !defined(GOTTHARD2D) && \
- !defined(MYTHEN3D)
+#if !defined(GOTTHARD2D) && !defined(MYTHEN3D)
functionNotImplemented();
#else
// get only
- enum CLKINDEX c = 0;
- switch (arg) {
-#if defined(EIGERD) || defined(JUNGFRAUD)
- case RUN_CLOCK:
- c = RUN_CLK;
- break;
-#endif
- default:
-#if defined(GOTTHARD2D) || defined(MYTHEN3D)
- if (arg < NUM_CLOCKS) {
- c = (enum CLKINDEX)arg;
- break;
- }
-#endif
- modeNotImplemented("clock index (divider get)", arg);
- break;
+ if (arg >= NUM_CLOCKS) {
+ modeNotImplemented("clock index (divider set)", arg);
}
if (ret == OK) {
+ enum CLKINDEX c = (enum CLKINDEX)arg;
retval = getClockDivider(c);
char *clock_names[] = {CLK_NAMES};
LOG(logDEBUG1, ("retval %s clock (%d) divider: %d\n", clock_names[c],
@@ -6740,9 +6774,9 @@ int set_current_source(int file_des) {
int fix = args[1];
int normal = args[2];
- LOG(logINFOBLUE, ("Setting current source [enable:%d, fix:%d, select:%lld, "
- "normal:%d]\n",
- enable, fix, (long long int)select, normal));
+ LOG(logDEBUG1, ("Setting current source [enable:%d, fix:%d, select:%lld, "
+ "normal:%d]\n",
+ enable, fix, (long long int)select, normal));
#if !defined(GOTTHARD2D) && !defined(JUNGFRAUD)
functionNotImplemented();
@@ -6751,25 +6785,26 @@ int set_current_source(int file_des) {
if (Server_VerifyLock() == OK) {
if (enable != 0 && enable != 1) {
ret = FAIL;
- strcpy(mess,
- "Could not enable/disable current source. Enable can be 0 or 1 only.\n");
+ strcpy(mess, "Could not enable/disable current source. Enable can "
+ "be 0 or 1 only.\n");
LOG(logERROR, (mess));
- }
+ }
// disable
- else if (enable == 0 && (fix != -1 || normal != -1)) {
+ else if (enable == 0 && (fix != -1 || normal != -1)) {
ret = FAIL;
- strcpy(mess,
- "Could not disable current source. Requires no parameters.\n");
- LOG(logERROR, (mess));
+ strcpy(
+ mess,
+ "Could not disable current source. Requires no parameters.\n");
+ LOG(logERROR, (mess));
}
// enable
else if (enable == 1) {
-#ifdef GOTTHARD2D
+#ifdef GOTTHARD2D
// no parameters allowed
if (fix != -1 || normal != -1) {
ret = FAIL;
- strcpy(mess,
- "Could not enable current source. Fix and normal are invalid parameters for this detector.\n");
+ strcpy(mess, "Could not enable current source. Fix and normal "
+ "are invalid parameters for this detector.\n");
LOG(logERROR, (mess));
}
#else
@@ -6792,7 +6827,8 @@ int set_current_source(int file_des) {
if (fix != 0 && fix != 1) {
ret = FAIL;
strcpy(mess,
- "Could not enable current source. Invalid value for parameter (fix). Options: 0 or 1.\n");
+ "Could not enable current source. Invalid value "
+ "for parameter (fix). Options: 0 or 1.\n");
LOG(logERROR, (mess));
} else if (normal != -1) {
ret = FAIL;
@@ -6826,7 +6862,8 @@ int set_current_source(int file_des) {
#endif
int retval = getCurrentSource();
LOG(logDEBUG1, ("current source enable retval: %u\n", retval));
- validate(&ret, mess, enable, retval, "set current source enable", DEC);
+ validate(&ret, mess, enable, retval, "set current source enable",
+ DEC);
}
}
#endif
@@ -7892,10 +7929,11 @@ int set_filter_resistor(int file_des) {
if (Server_VerifyLock() == OK) {
if (arg < 0 || arg > ASIC_FILTER_MAX_RES_VALUE) {
ret = FAIL;
- sprintf(mess,
- "Could not set filter resistor. Invalid filter argument %d. "
- "Options [0-%d]\n",
- arg, ASIC_FILTER_MAX_RES_VALUE);
+ sprintf(
+ mess,
+ "Could not set filter resistor. Invalid filter argument %d. "
+ "Options [0-%d]\n",
+ arg, ASIC_FILTER_MAX_RES_VALUE);
LOG(logERROR, (mess));
}
#ifdef JUNGFRAUD
@@ -7911,7 +7949,7 @@ int set_filter_resistor(int file_des) {
if (ret == FAIL) {
ret = FAIL;
strcpy(mess, "Could not set filter resistor.\n");
- LOG(logERROR, (mess));
+ LOG(logERROR, (mess));
}
#ifndef JUNGFRAUD
// jungfrau might take time to update status register if acquiring
@@ -8528,8 +8566,8 @@ int set_veto_algorithm(int file_des) {
enum vetoAlgorithm alg = args[0];
enum streamingInterface interface = args[1];
- LOG(logDEBUG1, ("Setting vetoalgorithm (interface: %d): %u\n", (int)interface,
- (int)alg));
+ LOG(logDEBUG1, ("Setting vetoalgorithm (interface: %d): %u\n",
+ (int)interface, (int)alg));
#ifndef GOTTHARD2D
functionNotImplemented();
@@ -8819,10 +8857,10 @@ int set_flip_rows(int file_des) {
#else
// only set
if (Server_VerifyLock() == OK) {
- if ((check_detector_idle("set flip rows") == OK) && (arg != 0 && arg != 1)) {
+ if ((check_detector_idle("set flip rows") == OK) &&
+ (arg != 0 && arg != 1)) {
ret = FAIL;
- sprintf(mess,
- "Could not set flip rows. Invalid argument %d.\n",
+ sprintf(mess, "Could not set flip rows. Invalid argument %d.\n",
arg);
LOG(logERROR, (mess));
}
@@ -8848,7 +8886,6 @@ int set_flip_rows(int file_des) {
return Server_SendResult(file_des, INT32, NULL, 0);
}
-
int get_filter_cell(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
@@ -8884,7 +8921,8 @@ int set_filter_cell(int file_des) {
if (arg < 0 || arg > MAX_FILTER_CELL_VAL) {
ret = FAIL;
sprintf(mess,
- "Could not set filter cell. Invalid argument %d. Options: 0 - %d\n",
+ "Could not set filter cell. Invalid argument %d. Options: "
+ "0 - %d\n",
arg, MAX_FILTER_CELL_VAL);
LOG(logERROR, (mess));
}
@@ -8896,7 +8934,8 @@ int set_filter_cell(int file_des) {
LOG(logERROR, (mess));
} else {
setFilterCell(arg);
- // no validation as it might take time to update status register if acquiring
+ // no validation as it might take time to update status register if
+ // acquiring
}
}
#endif
@@ -9011,12 +9050,12 @@ int get_dest_udp_list(int file_des) {
#if !defined(EIGERD) && !defined(JUNGFRAUD)
functionNotImplemented();
#else
- if (arg > MAX_UDP_DESTINATION) {
+ if (arg >= MAX_UDP_DESTINATION) {
ret = FAIL;
sprintf(
mess,
"Could not set udp destination. Invalid entry. Options: 0 - %d\n",
- MAX_UDP_DESTINATION);
+ MAX_UDP_DESTINATION - 1);
LOG(logERROR, (mess));
} else {
retvals[0] = arg;
@@ -9064,8 +9103,8 @@ int set_dest_udp_list(int file_des) {
return printSocketReadError();
// swap ip
- args[3] = __builtin_bswap32(args[3]);
- args[4] = __builtin_bswap32(args[4]);
+ args[3] = __builtin_bswap32(args[3]);
+ args[4] = __builtin_bswap32(args[4]);
// convert to string
char ip[INET_ADDRSTRLEN], ip2[INET_ADDRSTRLEN];
@@ -9084,22 +9123,21 @@ int set_dest_udp_list(int file_des) {
LOG(logINFOBLUE,
("Setting udp dest. [%d]: [port %d, port2 %d, ip %s, ip2 %s, "
"mac %s, mac2 %s]\n",
- entry, args[1], args[2], ip, ip2, mac, mac2));
+ entry, args[1], args[2], ip, ip2, mac, mac2));
- if (entry < 1 || entry > MAX_UDP_DESTINATION) {
+ if (entry < 1 || entry >= MAX_UDP_DESTINATION) {
ret = FAIL;
- sprintf(
- mess,
- "Could not set udp destination. Invalid entry. Options: 1 - %d\n",
- MAX_UDP_DESTINATION);
+ sprintf(mess,
+ "Could not set udp destination. Invalid entry. Options: 1 "
+ "- %d\n",
+ MAX_UDP_DESTINATION - 1);
LOG(logERROR, (mess));
- }
+ }
#ifdef EIGERD
else if (args[4] != 0 || args64[1] != 0) {
ret = FAIL;
- strcpy(
- mess,
- "Could not set udp destination. ip2 and mac2 not implemented for this detector.\n");
+ strcpy(mess, "Could not set udp destination. ip2 and mac2 not "
+ "implemented for this detector.\n");
LOG(logERROR, (mess));
}
#endif
@@ -9108,7 +9146,7 @@ int set_dest_udp_list(int file_des) {
if (args[1] != 0) {
udpDetails[entry].dstport = args[1];
}
- if (args[2] != 0) {
+ if (args[2] != 0) {
udpDetails[entry].dstport2 = args[2];
}
if (args[3] != 0) {
@@ -9131,12 +9169,14 @@ int set_dest_udp_list(int file_des) {
#endif
udpDetails[entry].srcport = DEFAULT_UDP_SRC_PORTNO;
if (udpDetails[entry].dstport == 0) {
- udpDetails[entry].dstport = 2 * entry + DEFAULT_UDP_DST_PORTNO;
+ udpDetails[entry].dstport =
+ 2 * entry + DEFAULT_UDP_DST_PORTNO;
}
if (myDetectorType == EIGER || twoInterfaces) {
udpDetails[entry].srcport2 = DEFAULT_UDP_SRC_PORTNO + 1;
if (udpDetails[entry].dstport2 == 0) {
- udpDetails[entry].dstport2 = 2 * entry + 1 + DEFAULT_UDP_DST_PORTNO;
+ udpDetails[entry].dstport2 =
+ 2 * entry + 1 + DEFAULT_UDP_DST_PORTNO;
}
}
// if still 0, copy from entry 0
@@ -9162,7 +9202,7 @@ int set_dest_udp_list(int file_des) {
}
// find number of destinations
int numdest = 0;
- for (int i = MAX_UDP_DESTINATION; i >= 0; --i) {
+ for (int i = MAX_UDP_DESTINATION - 1; i >= 0; --i) {
if (udpDetails[i].dstip != 0) {
numdest = i + 1;
break;
@@ -9206,11 +9246,12 @@ int get_num_dest_list(int file_des) {
int retval1 = 0;
if (getNumberofDestinations(&retval1) == FAIL || retval1 != retval) {
- ret = FAIL;
- sprintf(
- mess,
- "Could not get number of udp destinations. (server reads %d, fpga reads %d).\n", retval1, retval);
- LOG(logERROR, (mess));
+ ret = FAIL;
+ sprintf(mess,
+ "Could not get number of udp destinations. (server reads %d, "
+ "fpga reads %d).\n",
+ retval1, retval);
+ LOG(logERROR, (mess));
}
#endif
@@ -9277,10 +9318,11 @@ int set_udp_first_dest(int file_des) {
if (check_detector_idle("set first udp destination") == OK) {
setFirstUDPDestination(arg);
int retval = getFirstUDPDestination();
- validate(&ret, mess, arg, retval, "set udp first destination", DEC);
+ validate(&ret, mess, arg, retval, "set udp first destination",
+ DEC);
if (ret == OK) {
firstUDPDestination = arg;
- //configure_mac();
+ // configure_mac();
}
}
}
@@ -9288,3 +9330,83 @@ int set_udp_first_dest(int file_des) {
#endif
return Server_SendResult(file_des, INT32, NULL, 0);
}
+
+int get_readout_speed(int file_des) {
+ ret = OK;
+ memset(mess, 0, sizeof(mess));
+ int retval = -1;
+ LOG(logDEBUG1, ("Getting readout speed\n"));
+
+#if !defined(JUNGFRAUD) && !defined(EIGERD) && !defined(GOTTHARD2D)
+ functionNotImplemented();
+#else
+ // get only
+ ret = getReadoutSpeed(&retval);
+ LOG(logDEBUG1, ("retval readout speed: %d\n", retval));
+ if (ret == FAIL) {
+ strcpy(mess, "Could not get readout speed\n");
+ LOG(logERROR, (mess));
+ }
+#endif
+ return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
+}
+
+int set_readout_speed(int file_des) {
+ ret = OK;
+ memset(mess, 0, sizeof(mess));
+ int arg = -1;
+
+ if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
+ return printSocketReadError();
+ LOG(logDEBUG1, ("Setting readout speed : %u\n", arg));
+
+#if !defined(JUNGFRAUD) && !defined(EIGERD) && !defined(GOTTHARD2D)
+ functionNotImplemented();
+#else
+ // only set
+ if (Server_VerifyLock() == OK) {
+#ifdef JUNGFRAUD
+ if (arg == (int)FULL_SPEED && isHardwareVersion2()) {
+ ret = FAIL;
+ strcpy(
+ mess,
+ "Full speed not implemented for this board version (v1.0).\n");
+ LOG(logERROR, (mess));
+ }
+#endif
+ if (ret == OK) {
+ switch (arg) {
+#if defined(EIGERD) || defined(JUNGFRAUD)
+ case FULL_SPEED:
+ case HALF_SPEED:
+ case QUARTER_SPEED:
+#elif GOTTHARD2D
+ case G2_108MHZ:
+ case G2_144MHZ:
+#endif
+ break;
+ default:
+ modeNotImplemented("readout speed index", arg);
+ break;
+ }
+ if (ret == OK) {
+ ret = setReadoutSpeed(arg);
+ if (ret == FAIL) {
+ sprintf(mess, "Could not set readout speed to %d.\n", arg);
+ LOG(logERROR, (mess));
+ } else {
+ int retval = 0;
+ ret = getReadoutSpeed(&retval);
+ LOG(logDEBUG1, ("retval readout speed: %d\n", retval));
+ if (ret == FAIL) {
+ strcpy(mess, "Could not get readout speed\n");
+ LOG(logERROR, (mess));
+ }
+ validate(&ret, mess, arg, retval, "set readout speed", DEC);
+ }
+ }
+ }
+ }
+#endif
+ return Server_SendResult(file_des, INT32, NULL, 0);
+}
\ No newline at end of file
diff --git a/slsDetectorServers/stripDetectorDaemon/Makefile b/slsDetectorServers/stripDetectorDaemon/Makefile
index 1935c390d..4b2c764e9 100644
--- a/slsDetectorServers/stripDetectorDaemon/Makefile
+++ b/slsDetectorServers/stripDetectorDaemon/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
current_dir = $(shell pwd)
CROSS = nios2-buildroot-linux-gnu-
diff --git a/slsDetectorServers/stripDetectorDaemon/stripd.c b/slsDetectorServers/stripDetectorDaemon/stripd.c
index 873a2cb6e..6be9f0111 100644
--- a/slsDetectorServers/stripDetectorDaemon/stripd.c
+++ b/slsDetectorServers/stripDetectorDaemon/stripd.c
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include
#include
#include
diff --git a/slsDetectorSoftware/CMakeLists.txt b/slsDetectorSoftware/CMakeLists.txt
index 91697a939..1a6b922f0 100755
--- a/slsDetectorSoftware/CMakeLists.txt
+++ b/slsDetectorSoftware/CMakeLists.txt
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: LGPL-3.0-or-other
+# Copyright (C) 2021 Contributors to the SLS Detector Package
set(SOURCES
src/DetectorImpl.cpp
src/Module.cpp
@@ -41,6 +43,8 @@ if(SLS_BUILD_SHARED_LIBRARIES)
add_library(slsDetectorShared SHARED $)
target_link_libraries(slsDetectorShared PUBLIC slsDetectorObject)
set_target_properties(slsDetectorShared PROPERTIES
+ VERSION ${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}
+ SOVERSION ${PACKAGE_VERSION_MAJOR}
LIBRARY_OUTPUT_NAME SlsDetector
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
PUBLIC_HEADER "${PUBLICHEADERS}"
diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h
index e35bd4739..94dc2ad14 100644
--- a/slsDetectorSoftware/include/sls/Detector.h
+++ b/slsDetectorSoftware/include/sls/Detector.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/Pattern.h"
#include "sls/Result.h"
@@ -81,7 +83,8 @@ class Detector {
/* [Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench] */
Result getSerialNumber(Positions pos = {}) const;
- /** [Eiger][Gotthard2][Mythen3] 6 bit value (ideally unique) that is streamed out in the UDP header of the detector.*/
+ /** [Eiger][Gotthard2][Mythen3] 6 bit value (ideally unique) that is
+ * streamed out in the UDP header of the detector.*/
Result getModuleId(Positions pos = {}) const;
Result getReceiverVersion(Positions pos = {}) const;
@@ -300,16 +303,21 @@ class Detector {
/** list of possible timing modes for this detector */
std::vector getTimingModeList() const;
- /** [Eiger][Jungfrau] */
- Result getSpeed(Positions pos = {}) const;
+ /** [Eiger][Jungfrau][Gotthard2] */
+ Result getReadoutSpeed(Positions pos = {}) const;
- /** [Eiger][Jungfrau]
- * Options: FULL_SPEED, HALF_SPEED, QUARTER_SPEED \n
- * [Jungfrau] FULL_SPEED option only available from v2.0 boards and with
- * setting number of interfaces to 2. \n Also overwrites adcphase to
- * recommended default.
+ /** [Eiger][Jungfrau][Gotthard2]
+ * [Jungfrau] Options: FULL_SPEED, HALF_SPEED (Default), QUARTER_SPEED \n
+ * [Eiger] Options: FULL_SPEED (Default), HALF_SPEED, QUARTER_SPEED \n
+ * [Gotthard2] Options: G2_108MHZ (Default), G2_144MHZ \n
+ * [Jungfrau] FULL_SPEED option only available from v2.0 boards and is
+ * recommended to set number of interfaces to 2. \n Also overwrites adcphase
+ * to recommended default.
*/
- void setSpeed(defs::speedLevel value, Positions pos = {});
+ void setReadoutSpeed(defs::speedLevel value, Positions pos = {});
+
+ /** list of possible readoutspeed modes for this detector */
+ std::vector getReadoutSpeedList() const;
/** [Jungfrau][CTB][Moench] */
Result getADCPhase(Positions pos = {}) const;
@@ -397,8 +405,9 @@ class Detector {
* [Moench] Default is disabled. \n
* [Jungfrau] Default is disabled. Get will return power status. Can be off
* if temperature event occured (temperature over temp_threshold with
- * temp_control enabled. Will configure chip (only chip v1.1)\n [Mythen3][Gotthard2] Default is 1. If module not
- * connected or wrong module, powerchip will fail.
+ * temp_control enabled. Will configure chip (only chip v1.1)\n
+ * [Mythen3][Gotthard2] Default is 1. If module not connected or wrong
+ * module, powerchip will fail.
*/
void setPowerChip(bool on, Positions pos = {});
@@ -511,7 +520,9 @@ class Detector {
/** [Eiger] Number of rows to read out per half module
* Options: 0 - 256. 256 is default. The permissible values depend on
- * dynamic range and 10Gbe enabled. \n[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512.
+ * dynamic range and 10Gbe enabled. \n[Jungfrau] Number of rows per module
+ * starting from the centre. Options: 8 - 512, must be multiples of 8.
+ * Default is 512.
*/
void setReadNRows(const int lines, Positions pos = {});
@@ -1219,7 +1230,8 @@ class Detector {
Result getStorageCellStart(Positions pos = {}) const;
/** [Jungfrau] Advanced. Sets the storage cell storing the first acquisition
- * of the series. Options: 0-max. max is 15 (default) for chipv1.0 and 3 (default) for chipv1.1.
+ * of the series. Options: 0-max. max is 15 (default) for chipv1.0 and 3
+ * (default) for chipv1.1.
*/
void setStorageCellStart(int cell, Positions pos = {});
@@ -1228,7 +1240,7 @@ class Detector {
/** [Jungfrau] Advanced \n Additional time delay between 2 consecutive
* exposures in burst mode. \n Options: (0-1638375 ns (resolution of 25ns)\n
- * Only applicable for chipv1.0.
+ * Only applicable for chipv1.0.
*/
void setStorageCellDelay(ns value, Positions pos = {});
@@ -1360,14 +1372,15 @@ class Detector {
/** [Gotthard2] */
Result getVetoStream(Positions pos = {}) const;
- /** [Gotthard2] Options: NONE (Default), LOW_LATENCY_LINK, ETHERNET_10GB (debugging), ALL
- * Enable or disable the 2 veto streaming interfaces available. Can
- * concatenate more than one interface. \nLOW_LATENCY_LINK is the default
- * interface to work with. \nETHERNET_10GB is for debugging and also enables second
- * interface in receiver for listening to veto packets (writes a separate
- * file if writing enabled). Also restarts client and receiver zmq sockets
- * if zmq streaming enabled.*/
- void setVetoStream(const defs::streamingInterface value, Positions pos = {});
+ /** [Gotthard2] Options: NONE (Default), LOW_LATENCY_LINK, ETHERNET_10GB
+ * (debugging), ALL Enable or disable the 2 veto streaming interfaces
+ * available. Can concatenate more than one interface. \nLOW_LATENCY_LINK is
+ * the default interface to work with. \nETHERNET_10GB is for debugging and
+ * also enables second interface in receiver for listening to veto packets
+ * (writes a separate file if writing enabled). Also restarts client and
+ * receiver zmq sockets if zmq streaming enabled.*/
+ void setVetoStream(const defs::streamingInterface value,
+ Positions pos = {});
/** [Gotthard2] */
Result
@@ -1539,7 +1552,7 @@ class Detector {
/** [CTB] */
void setDBITClock(int value_in_MHz, Positions pos = {});
- /**
+ /**
* [CTB] mV
* Options: V_POWER_A, V_POWER_B, V_POWER_C, V_POWER_D, V_POWER_IO */
Result getMeasuredVoltage(defs::dacIndex index,
@@ -1723,21 +1736,24 @@ class Detector {
* *
* ************************************************/
- /** Advanced user Function!
- * [Jungfrau][CTB][Moench] fname is a pof file, rebooting the controller is
- * recommended \n [Mythen3][Gotthard2] fname is an rbf file, power cycling
- * the detector is recommended
+ /** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
+ * Advanced user Function!
+ * Program firmware from command line, after which detector controller is
+ * rebooted. [Jungfrau][CTB][Moench] fname is a pof file (full path) \n
+ * [Mythen3][Gotthard2] fname is an rbf file (full path)
*/
void programFPGA(const std::string &fname, Positions pos = {});
/** [Jungfrau][CTB][Moench] Advanced user Function! */
void resetFPGA(Positions pos = {});
- /** [Jungfrau][Gotthard][CTB][Moench][Mythen3][Gotthard2]
+ /** [Jungfrau][Eiger][Gotthard][CTB][Moench][Mythen3][Gotthard2]
* Advanced user Function! \n
- * Copy detector server fname from tftp folder of hostname to detector \n
- * [Jungfrau][Gotthard][CTB][Moench] Also changes respawn server, which is
- * effective after a reboot.
+ * Copy detector server fname from tftp folder of hostname to detector. Also
+ * creates a symbolic link to a shorter name (without vx.x.x). Then the
+ * detector controller reboots (except eiger) \n
+ * [Jungfrau][Gotthard][CTB][Moench] Also changes respawn server (to the
+ * link), which is effective after a reboot.
*/
void copyDetectorServer(const std::string &fname,
const std::string &hostname, Positions pos = {});
@@ -1748,11 +1764,11 @@ class Detector {
/**
* Advanced user Function!\n [Jungfrau][Gotthard][CTB][Moench] Updates the
- * firmware, detector server and then reboots detector controller blackfin.
- * \n [Mythen3][Gotthard2] Will still have old server starting up as the new
- * server is not respawned \n sname is name of detector server binary found
- * on tftp folder of host pc \n hostname is name of pc to tftp from \n fname
- * is programming file name
+ * firmware, detector server, make a soft link and then reboots detector
+ * controller. \n [Mythen3][Gotthard2] Will require a script to start up the
+ * shorter named server link at start up \n sname is name of detector
+ * server binary found on tftp folder of host pc \n hostname is name of pc
+ * to tftp from \n fname is programming file name with full path to it
*/
void updateFirmwareAndServer(const std::string &sname,
const std::string &hostname,
diff --git a/slsDetectorSoftware/include/sls/Pattern.h b/slsDetectorSoftware/include/sls/Pattern.h
index 7f435ba54..7319a3f94 100644
--- a/slsDetectorSoftware/include/sls/Pattern.h
+++ b/slsDetectorSoftware/include/sls/Pattern.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/sls_detector_defs.h"
diff --git a/slsDetectorSoftware/include/sls/Result.h b/slsDetectorSoftware/include/sls/Result.h
index c7f71e481..2578ad2ba 100644
--- a/slsDetectorSoftware/include/sls/Result.h
+++ b/slsDetectorSoftware/include/sls/Result.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
/**
@@ -68,7 +70,7 @@ template > class Result {
* @tparam Args template paramter pack to forward
*/
template
- Result(Args &&... args) : vec(std::forward(args)...) {}
+ Result(Args &&...args) : vec(std::forward(args)...) {}
using value_type = typename std::vector::value_type;
using iterator = typename std::vector::iterator;
diff --git a/slsDetectorSoftware/include/sls/detectorData.h b/slsDetectorSoftware/include/sls/detectorData.h
index b4fbaf089..3205dbdce 100644
--- a/slsDetectorSoftware/include/sls/detectorData.h
+++ b/slsDetectorSoftware/include/sls/detectorData.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include
#include
diff --git a/slsDetectorSoftware/src/CmdLineApp.cpp b/slsDetectorSoftware/src/CmdLineApp.cpp
index fc7867ce3..cc86cfcfa 100644
--- a/slsDetectorSoftware/src/CmdLineApp.cpp
+++ b/slsDetectorSoftware/src/CmdLineApp.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
/*
This file is used to generate the command line binaries
diff --git a/slsDetectorSoftware/src/CmdParser.cpp b/slsDetectorSoftware/src/CmdParser.cpp
index ab7dc52ad..109a50b77 100644
--- a/slsDetectorSoftware/src/CmdParser.cpp
+++ b/slsDetectorSoftware/src/CmdParser.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "CmdParser.h"
#include "sls/string_utils.h"
diff --git a/slsDetectorSoftware/src/CmdParser.h b/slsDetectorSoftware/src/CmdParser.h
index 7e1bd970e..47a1703ea 100644
--- a/slsDetectorSoftware/src/CmdParser.h
+++ b/slsDetectorSoftware/src/CmdParser.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
/*
This class parses command line input or string input to extract the
diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp
index 1cfff609d..2c46b78c0 100644
--- a/slsDetectorSoftware/src/CmdProxy.cpp
+++ b/slsDetectorSoftware/src/CmdProxy.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "CmdProxy.h"
#include "HelpDacs.h"
#include "sls/TimeHelper.h"
@@ -605,57 +607,38 @@ std::string CmdProxy::Exptime(int action) {
return os.str();
}
-std::string CmdProxy::Speed(int action) {
+std::string CmdProxy::ReadoutSpeed(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
- os << "[0 or full_speed|1 or half_speed|2 or "
- "quarter_speed]\n\t[Eiger][Jungfrau] Readout speed of "
- "chip.\n\t[Jungfrau] FULL_SPEED option only available from v2.0 "
- "boards and with setting number of interfaces to 2. Also "
- "overwrites adcphase to recommended default. "
+ os << "\n\t[0 or full_speed|1 or half_speed|2 or "
+ "quarter_speed]\n\t\t[Eiger][Jungfrau] Readout "
+ "speed of chip.\n\t\t[Eiger] Default speed is full_speed."
+ "\n\t\t[Jungfrau] Default speed is half_speed. full_speed "
+ "option only available from v2.0 boards and is recommended to "
+ "set "
+ "number of interfaces to 2. Also overwrites "
+ "adcphase to recommended default.\n\t [144|108]\n\t\t[Gotthard2] "
+ "Readout speed of chip in MHz. Default is 108."
<< '\n';
} else {
defs::detectorType type = det->getDetectorType().squash();
if (type == defs::CHIPTESTBOARD || type == defs::MOENCH) {
throw sls::RuntimeError(
- "Speed not implemented. Did you mean runclk?");
- }
- if (type != defs::EIGER && type != defs::JUNGFRAU) {
- throw sls::RuntimeError(
- "Speed not implemented."); // setspped one function problem. tbr
- // after change
+ "ReadoutSpeed not implemented. Did you mean runclk?");
}
if (action == defs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
- auto t = det->getSpeed(std::vector{det_id});
+ auto t = det->getReadoutSpeed(std::vector{det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
- defs::speedLevel t;
- try {
- int ival = StringTo(args[0]);
- switch (ival) {
- case 0:
- t = defs::FULL_SPEED;
- break;
- case 1:
- t = defs::HALF_SPEED;
- break;
- case 2:
- t = defs::QUARTER_SPEED;
- break;
- default:
- throw sls::RuntimeError("Unknown speed " + args[0]);
- }
- } catch (...) {
- t = sls::StringTo(args[0]);
- }
- det->setSpeed(t, std::vector{det_id});
+ defs::speedLevel t = sls::StringTo(args[0]);
+ det->setReadoutSpeed(t, std::vector{det_id});
os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well
} else {
throw sls::RuntimeError("Unknown action");
@@ -965,7 +948,8 @@ std::string CmdProxy::CurrentSource(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
- os << "\n\t[0|1]\n\t\t[Gotthard2] Enable or disable current source. Default "
+ os << "\n\t[0|1]\n\t\t[Gotthard2] Enable or disable current source. "
+ "Default "
"is disabled.\n\t[0|1] [fix|nofix] [select source] [(only for "
"chipv1.1)normal|low]\n\t\t[Jungfrau] Disable or enable current "
"source with some parameters. The select source is 0-63 for "
@@ -995,7 +979,7 @@ std::string CmdProxy::CurrentSource(int action) {
}
if (args.size() == 3) {
det->setCurrentSource(defs::currentSrcParameters(
- fix, StringTo(args[2])));
+ fix, StringTo(args[2])));
} else if (args.size() == 4) {
bool normalCurrent = false;
if (args[3] == "normal") {
@@ -1007,7 +991,7 @@ std::string CmdProxy::CurrentSource(int action) {
". Did you mean normal or low?");
}
det->setCurrentSource(defs::currentSrcParameters(
- fix, StringTo(args[2]), normalCurrent));
+ fix, StringTo(args[2]), normalCurrent));
} else {
throw sls::RuntimeError(
"Invalid number of parareters for this command.");
@@ -1338,7 +1322,8 @@ std::string CmdProxy::Trigger(int action) {
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
if (cmd == "trigger") {
- os << "\n\t[Eiger][Mythen3] Sends software trigger signal to detector";
+ os << "\n\t[Eiger][Mythen3] Sends software trigger signal to "
+ "detector";
} else if (cmd == "blockingtrigger") {
os << "\n\t[Eiger] Sends software trigger signal to detector and "
"blocks till "
@@ -2050,7 +2035,8 @@ std::string CmdProxy::VetoStreaming(int action) {
if (action == defs::HELP_ACTION) {
os << "[none|lll|10gbe|...]\n\t[Gotthard2] Enable or disable the 2 "
"veto streaming interfaces available. Can include more than one "
- "interface. \n\tDefault: none. lll (low latency link) is the default "
+ "interface. \n\tDefault: none. lll (low latency link) is the "
+ "default "
"interface to work with. \n\t10GbE is for debugging and also "
"enables second interface in receiver for listening to veto "
"packets (writes a separate file if writing enabled). Also "
@@ -2833,10 +2819,11 @@ std::string CmdProxy::ProgramFpga(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
- os << "[fname.pof | fname.rbf]\n\t[Jungfrau][Ctb][Moench] Programs "
- "FPGA from pof file. Rebooting controller is recommended. "
- "\n\t[Mythen3][Gotthard2] Programs FPGA from rbf file. Power "
- "cycling the detector is recommended. "
+ os << "[fname.pof | fname.rbf (full path)]\n\t[Jungfrau][Ctb][Moench] "
+ "Programs FPGA from pof file (full path). Then, detector "
+ "controller is rebooted \n\t[Mythen3][Gotthard2] Programs FPGA "
+ "from rbf file (full path). Then, detector controller is "
+ "rebooted."
<< '\n';
} else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get");
@@ -2856,11 +2843,13 @@ std::string CmdProxy::CopyDetectorServer(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
- os << "[server_name] "
- "[pc_host_name]\n\t[Jungfrau][Ctb][Moench][Mythen3][Gotthard2] "
- "Copies detector server via tftp from pc. "
- "\n\t[Jungfrau][Ctb][Moench]Also changes respawn server, which "
- "is effective after a reboot."
+ os << "[server_name (in tftp folder)] "
+ "[pc_host_name]\n\t[Jungfrau][Eiger][Ctb][Moench][Mythen3]["
+ "Gotthard2] Copies detector server via tftp from pc. Ensure that "
+ "server is in the pc's tftp folder. Makes a symbolic link with a "
+ "shorter name (without vx.x.x). Then, detector reboots (except "
+ "Eiger).\n\t[Jungfrau][Ctb][Moench]Also changes respawn server "
+ "to the link, which is effective after a reboot."
<< '\n';
} else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get");
@@ -2880,14 +2869,14 @@ std::string CmdProxy::UpdateFirmwareAndDetectorServer(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
- os << "[server_name] [pc_host_name] "
- "[fname.pof]\n\t[Jungfrau][Gotthard][CTB][Moench] Updates the "
- "firmware, detector server and then reboots detector controller "
- "blackfin. \n\t[Mythen3][Gotthard2] Will still have old server "
- "starting up as the new server is not respawned \n\tsname is "
- "name of detector server binary found on tftp folder of host pc "
- "\n\thostname is name of pc to tftp from \n\tfname is "
- "programming file name"
+ os << "[server_name (in tftp folder)] [pc_host_name] [fname.pof (incl "
+ "full path)]\n\t[Jungfrau][Gotthard][CTB][Moench] Updates the "
+ "firmware, detector server, creates the symbolic link and then "
+ "reboots detector controller. \n\t[Mythen3][Gotthard2] will "
+ "require a script to start up the shorter named server link at "
+ "start up. \n\tsname is name of detector server binary found on "
+ "tftp folder of host pc \n\thostname is name of pc to tftp from "
+ "\n\tfname is programming file name"
<< '\n';
} else if (action == defs::GET_ACTION) {
throw sls::RuntimeError("Cannot get");
diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h
index 2424f89cd..c96c4f2e2 100644
--- a/slsDetectorSoftware/src/CmdProxy.h
+++ b/slsDetectorSoftware/src/CmdProxy.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "sls/Detector.h"
@@ -591,7 +593,8 @@ class CmdProxy {
/* acquisition parameters */
{"cycles", "triggers"},
{"cyclesl", "triggersl"},
- {"clkdivider", "speed"},
+ {"clkdivider", "readoutspeed"},
+ {"speed", "readoutspeed"},
{"vhighvoltage", "highvoltage"},
{"digitest", "imagetest"},
{"filter", "filterresistor"},
@@ -792,7 +795,8 @@ class CmdProxy {
{"drlist", &CmdProxy::drlist},
{"timing", &CmdProxy::timing},
{"timinglist", &CmdProxy::timinglist},
- {"speed", &CmdProxy::Speed},
+ {"readoutspeed", &CmdProxy::ReadoutSpeed},
+ {"readoutspeedlist", &CmdProxy::readoutspeedlist},
{"adcphase", &CmdProxy::Adcphase},
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
{"dbitphase", &CmdProxy::Dbitphase},
@@ -1097,7 +1101,7 @@ class CmdProxy {
std::string Acquire(int action);
std::string Exptime(int action);
std::string DynamicRange(int action);
- std::string Speed(int action);
+ std::string ReadoutSpeed(int action);
std::string Adcphase(int action);
std::string Dbitphase(int action);
std::string ClockFrequency(int action);
@@ -1205,10 +1209,10 @@ class CmdProxy {
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench]"
"Serial number of detector.");
- GET_COMMAND(
- moduleid, getModuleId,
- "\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) "
- "that is streamed out in the UDP header of the detector. Picked up from a file on the module.");
+ GET_COMMAND(moduleid, getModuleId,
+ "\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) "
+ "that is streamed out in the UDP header of the detector. "
+ "Picked up from a file on the module.");
GET_COMMAND(type, getDetectorType,
"\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, "
@@ -1328,6 +1332,10 @@ class CmdProxy {
GET_COMMAND_NOID(timinglist, getTimingModeList,
"\n\tGets the list of timing modes for this detector.");
+ GET_COMMAND_NOID(
+ readoutspeedlist, getReadoutSpeedList,
+ "\n\tList of readout speed levels implemented for this detector.");
+
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of "
"ADC clock.");
@@ -1349,7 +1357,8 @@ class CmdProxy {
"the chip. \n\t[Moench] Default is 0. \n\t[Jungfrau] Default is 0. Get "
"will return power status. Can be off if temperature event occured "
"(temperature over temp_threshold with temp_control "
- "enabled. Will configure chip (only chip v1.1)\n\t[Mythen3][Gotthard2] Default is 1. If module not "
+ "enabled. Will configure chip (only chip v1.1)\n\t[Mythen3][Gotthard2] "
+ "Default is 1. If module not "
"connected or wrong module, powerchip will fail.");
INTEGER_COMMAND_VEC_ID(
@@ -1382,7 +1391,10 @@ class CmdProxy {
readnrows, getReadNRows, setReadNRows, StringTo,
"\n\t[1-256]\n\t\t[Eiger] Number of rows to readout per half module "
"starting from the centre. Options: 0 - 256. 256 is default. The "
- "permissible values depend on dynamic range and 10Gbe enabled.\n\t[8-512 (multiple of 8)]\n\t\t[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512.");
+ "permissible values depend on dynamic range and 10Gbe "
+ "enabled.\n\t[8-512 (multiple of 8)]\n\t\t[Jungfrau] Number of rows "
+ "per module starting from the centre. Options: 8 - 512, must be "
+ "multiples of 8. Default is 512.");
/** temperature */
GET_COMMAND_NOID(
@@ -1537,10 +1549,11 @@ class CmdProxy {
"[0, 1]\n\t[Jungfrau] The udp interface to stream data from detector. "
"Effective only when number of interfaces is 1. Default: 0 (outer)");
- GET_COMMAND(udp_numdst, getNumberofUDPDestinations,
- "\n\t[Jungfrau][Eiger] One can enter upto 32 "
- "destinations that the detector will stream images "
- "out in a round robin fashion. This is get only command. Default: 1");
+ GET_COMMAND(
+ udp_numdst, getNumberofUDPDestinations,
+ "\n\t[Jungfrau][Eiger] One can enter upto 32 "
+ "destinations that the detector will stream images "
+ "out in a round robin fashion. This is get only command. Default: 1");
EXECUTE_SET_COMMAND(udp_cleardst, clearUDPDestinations,
"\n\tClears udp destination details on the detector.");
@@ -1548,7 +1561,8 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID(
udp_firstdst, getFirstUDPDestination, setFirstUDPDestination,
StringTo,
- "[0 - 31 (or number of udp destinations)]\n\t[Jungfrau] One can set which is the first "
+ "[0 - 31 (or number of udp destinations)]\n\t[Jungfrau] One can set "
+ "which is the first "
"destination that the detector will stream images "
"out from in a round robin fashion. The entry must not have been "
"empty. Default: 0");
@@ -1856,10 +1870,9 @@ class CmdProxy {
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub "
"frame period between last sub frame and previous one.");
-
- INTEGER_COMMAND_VEC_ID(
- activate, getActive, setActive, StringTo,
- "[0, 1] \n\t[Eiger] 1 is default. 0 deactivates readout and does not send data.");
+ INTEGER_COMMAND_VEC_ID(activate, getActive, setActive, StringTo,
+ "[0, 1] \n\t[Eiger] 1 is default. 0 deactivates "
+ "readout and does not send data.");
INTEGER_COMMAND_VEC_ID(
partialreset, getPartialReset, setPartialReset, StringTo,
@@ -1912,7 +1925,8 @@ class CmdProxy {
INTEGER_COMMAND_SET_NOID_GET_ID(
storagecells, getNumberOfAdditionalStorageCells,
setNumberOfAdditionalStorageCells, StringTo,
- "[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional storage cells. Default is "
+ "[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional storage "
+ "cells. Default is "
"0. For advanced users only. \n\tThe #images = #frames x #triggers x "
"(#storagecells + 1).");
@@ -1920,13 +1934,15 @@ class CmdProxy {
storagecell_start, getStorageCellStart, setStorageCellStart,
StringTo,
"[0-max]\n\t[Jungfrau] Storage cell that stores the first acquisition "
- "of the series. max is 15 (default) for chipv1.0 and 3 (default) for chipv1.1. For advanced users only.");
+ "of the series. max is 15 (default) for chipv1.0 and 3 (default) for "
+ "chipv1.1. For advanced users only.");
TIME_COMMAND(
storagecell_delay, getStorageCellDelay, setStorageCellDelay,
"[duration (0-1638375 ns)] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] "
"Additional time delay between 2 consecutive exposures in burst mode "
- "(resolution of 25ns). Only applicable for chipv1.0. For advanced users only.");
+ "(resolution of 25ns). Only applicable for chipv1.0. For advanced "
+ "users only.");
INTEGER_COMMAND_VEC_ID(
gainmode, getGainMode, setGainMode,
@@ -1935,9 +1951,10 @@ class CmdProxy {
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, "
"you can damage the detector!!!");
- INTEGER_COMMAND_VEC_ID(
- filtercell, getFilterCell, setFilterCell, sls::StringTo,
- "[0-12]\n\t[Jungfrau] Set Filter Cell. Only for chipv1.1. Advanced user Command");
+ INTEGER_COMMAND_VEC_ID(filtercell, getFilterCell, setFilterCell,
+ sls::StringTo,
+ "[0-12]\n\t[Jungfrau] Set Filter Cell. Only for "
+ "chipv1.1. Advanced user Command");
/* Gotthard Specific */
TIME_GET_COMMAND(exptimel, getExptimeLeft,
diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp
index ccb8e8b40..5951e6889 100644
--- a/slsDetectorSoftware/src/Detector.cpp
+++ b/slsDetectorSoftware/src/Detector.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "sls/Detector.h"
#include "sls/detectorData.h"
@@ -412,18 +414,25 @@ std::vector Detector::getTimingModeList() const {
}
}
-Result Detector::getSpeed(Positions pos) const {
- auto res = pimpl->Parallel(&Module::getClockDivider, pos, defs::RUN_CLOCK);
- Result speedResult(res.size());
- for (unsigned int i = 0; i < res.size(); ++i) {
- speedResult[i] = static_cast(res[i]);
- }
- return speedResult;
+Result Detector::getReadoutSpeed(Positions pos) const {
+ return pimpl->Parallel(&Module::getReadoutSpeed, pos);
}
-void Detector::setSpeed(defs::speedLevel value, Positions pos) {
- pimpl->Parallel(&Module::setClockDivider, pos, defs::RUN_CLOCK,
- static_cast(value));
+void Detector::setReadoutSpeed(defs::speedLevel value, Positions pos) {
+ pimpl->Parallel(&Module::setReadoutSpeed, pos, value);
+}
+
+std::vector Detector::getReadoutSpeedList() const {
+ switch (getDetectorType().squash()) {
+ case defs::EIGER:
+ case defs::JUNGFRAU:
+ return std::vector{defs::FULL_SPEED, defs::HALF_SPEED,
+ defs::QUARTER_SPEED};
+ case defs::GOTTHARD2:
+ return std::vector{defs::G2_108MHZ, defs::G2_144MHZ};
+ default:
+ throw RuntimeError("Readout speed not implemented for this detector");
+ }
}
Result Detector::getADCPhase(Positions pos) const {
@@ -657,10 +666,6 @@ void Detector::setDefaultDac(defs::dacIndex index, int defaultValue,
pimpl->setDefaultDac(index, defaultValue, sett, pos);
}
-
-
-
-
void Detector::resetToDefaultDacs(const bool hardReset, Positions pos) {
pimpl->Parallel(&Module::resetToDefaultDacs, pos, hardReset);
}
@@ -822,10 +827,6 @@ Result Detector::getScanErrorMessage(Positions pos) const {
// Network Configuration (Detector<->Receiver)
Result Detector::getNumberofUDPInterfaces(Positions pos) const {
- if (getDetectorType().squash() != defs::JUNGFRAU) {
- throw sls::RuntimeError(
- "Cannot set number of udp interfaces for this detector.");
- }
// also called by vetostream (for gotthard2)
return pimpl->getNumberofUDPInterfaces(pos);
}
@@ -1450,7 +1451,6 @@ void Detector::setActive(const bool active, Positions pos) {
pimpl->Parallel(&Module::setActivate, pos, active);
}
-
Result Detector::getPartialReset(Positions pos) const {
return pimpl->Parallel(&Module::getCounterBit, pos);
}
@@ -1565,12 +1565,9 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
std::vector Detector::getGainModeList() const {
switch (getDetectorType().squash()) {
case defs::JUNGFRAU:
- return std::vector{defs::DYNAMIC,
- defs::FORCE_SWITCH_G1,
- defs::FORCE_SWITCH_G2,
- defs::FIX_G1,
- defs::FIX_G2,
- defs::FIX_G0};
+ return std::vector{
+ defs::DYNAMIC, defs::FORCE_SWITCH_G1, defs::FORCE_SWITCH_G2,
+ defs::FIX_G1, defs::FIX_G2, defs::FIX_G0};
break;
default:
throw RuntimeError("Gain mode is not implemented for this detector.");
@@ -1717,19 +1714,22 @@ Result Detector::getVetoStream(Positions pos) const {
return res;
}
-void Detector::setVetoStream(defs::streamingInterface interface, Positions pos) {
+void Detector::setVetoStream(defs::streamingInterface interface,
+ Positions pos) {
// 3gbe
- bool LOW_LATENCY_LINK = ((interface & defs::streamingInterface::LOW_LATENCY_LINK) ==
- defs::streamingInterface::LOW_LATENCY_LINK);
+ bool LOW_LATENCY_LINK =
+ ((interface & defs::streamingInterface::LOW_LATENCY_LINK) ==
+ defs::streamingInterface::LOW_LATENCY_LINK);
pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK);
// 10gbe (debugging interface) opens 2nd udp interface in receiver
int old_numinterfaces = pimpl->getNumberofUDPInterfaces(pos).tsquash(
"retrieved inconsistent number of udp interfaces");
- int numinterfaces = (((interface & defs::streamingInterface::ETHERNET_10GB) ==
- defs::streamingInterface::ETHERNET_10GB)
- ? 2
- : 1);
+ int numinterfaces =
+ (((interface & defs::streamingInterface::ETHERNET_10GB) ==
+ defs::streamingInterface::ETHERNET_10GB)
+ ? 2
+ : 1);
if (numinterfaces != old_numinterfaces) {
setNumberofUDPInterfaces_(numinterfaces, pos);
}
diff --git a/slsDetectorSoftware/src/DetectorImpl.cpp b/slsDetectorSoftware/src/DetectorImpl.cpp
index f5a455992..f9aa1a1ab 100644
--- a/slsDetectorSoftware/src/DetectorImpl.cpp
+++ b/slsDetectorSoftware/src/DetectorImpl.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "DetectorImpl.h"
#include "Module.h"
#include "SharedMemory.h"
@@ -289,7 +291,9 @@ void DetectorImpl::updateDetectorSize() {
const slsDetectorDefs::xy det_size = modules[0]->getNumberOfChannels();
if (det_size.x == 0 || det_size.y == 0) {
- throw sls::RuntimeError("Module size for x or y dimensions is 0. Unable to proceed in updating detector size. ");
+ throw sls::RuntimeError(
+ "Module size for x or y dimensions is 0. Unable to proceed in "
+ "updating detector size. ");
}
int maxx = shm()->numberOfChannels.x;
@@ -1092,13 +1096,13 @@ int DetectorImpl::acquire() {
// start and read all
try {
if (detector_type == defs::MYTHEN3 && modules.size() > 1) {
- //Multi module mythen
+ // Multi module mythen
std::vector master;
std::vector slaves;
auto is_master = Parallel(&Module::isMaster, {});
slaves.reserve(modules.size() - 1); // check this one!!
for (size_t i = 0; i < modules.size(); ++i) {
- if(is_master[i])
+ if (is_master[i])
master.push_back(i);
else
slaves.push_back(i);
@@ -1106,7 +1110,7 @@ int DetectorImpl::acquire() {
Parallel(&Module::startAcquisition, slaves);
Parallel(&Module::startAndReadAll, master);
} else {
- //Normal acquire
+ // Normal acquire
Parallel(&Module::startAndReadAll, {});
}
@@ -1358,7 +1362,7 @@ std::vector DetectorImpl::readProgrammingFile(const std::string &fname) {
LOG(logINFOBLUE) << "File has been converted to " << destfname;
// loading dst file to memory
- // FILE *fp = fopen("/tmp/SLS_DET_MCB.tzgmUT", "r");
+ // FILE *fp = fopen("/tmp/SLS_DET_MCB.tzgmUT", "r");
FILE *fp = fopen(destfname, "r");
if (fp == nullptr) {
throw RuntimeError("Program FPGA: Could not open rawbin file");
@@ -1382,7 +1386,7 @@ std::vector DetectorImpl::readProgrammingFile(const std::string &fname) {
"Program FPGA: Could not close destination file after converting");
}
- //unlink(destfname); // delete temporary file
+ // unlink(destfname); // delete temporary file
LOG(logDEBUG1) << "Successfully loaded the rawbin file to program memory";
LOG(logDEBUG1) << "Read file into memory";
return buffer;
diff --git a/slsDetectorSoftware/src/DetectorImpl.h b/slsDetectorSoftware/src/DetectorImpl.h
index e312979fb..37d57d7bf 100644
--- a/slsDetectorSoftware/src/DetectorImpl.h
+++ b/slsDetectorSoftware/src/DetectorImpl.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include "SharedMemory.h"
@@ -17,7 +19,7 @@ class detectorData;
#define DETECTOR_SHMAPIVERSION 0x190809
#define DETECTOR_SHMVERSION 0x201007
-#define SHORT_STRING_LENGTH 50
+#define SHORT_STRING_LENGTH 50
#include
#include
diff --git a/slsDetectorSoftware/src/HelpDacs.h b/slsDetectorSoftware/src/HelpDacs.h
index 93d2af134..236167838 100644
--- a/slsDetectorSoftware/src/HelpDacs.h
+++ b/slsDetectorSoftware/src/HelpDacs.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "sls/string_utils.h"
std::string GetHelpDac(std::string dac) {
diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp
index f80b383a1..8717fb88f 100644
--- a/slsDetectorSoftware/src/Module.cpp
+++ b/slsDetectorSoftware/src/Module.cpp
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: LGPL-3.0-or-other
+// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "Module.h"
#include "SharedMemory.h"
#include "sls/ClientSocket.h"
@@ -475,7 +477,8 @@ bool Module::getFlipRows() const {
void Module::setFlipRows(bool value) {
if (shm()->detType == EIGER) {
const int rxIndex = -1;
- sendToReceiver(rxIndex, F_SET_FLIP_ROWS_RECEIVER, static_cast(value));
+ sendToReceiver(rxIndex, F_SET_FLIP_ROWS_RECEIVER,
+ static_cast(value));
} else {
sendToDetector(F_SET_FLIP_ROWS, static_cast(value), nullptr);
}
@@ -505,7 +508,7 @@ void Module::setNumberOfTriggers(int64_t value) {
sendToDetector(F_SET_NUM_TRIGGERS, value, nullptr);
if (shm()->useReceiverFlag) {
const int rxIndex = -1;
- sendToReceiver(rxIndex, F_SET_RECEIVER_NUM_TRIGGERS, value, nullptr);
+ sendToReceiver(rxIndex, F_SET_RECEIVER_NUM_TRIGGERS, value, nullptr);
}
}
@@ -522,7 +525,7 @@ void Module::setExptime(int gateIndex, int64_t value) {
sendToDetector(F_SET_EXPTIME, args, nullptr);
if (shm()->useReceiverFlag) {
const int rxIndex = -1;
- sendToReceiver(rxIndex, F_RECEIVER_SET_EXPTIME, args, nullptr);
+ sendToReceiver(rxIndex, F_RECEIVER_SET_EXPTIME, args, nullptr);
}
if (prevVal != value) {
updateRateCorrection();
@@ -537,7 +540,7 @@ void Module::setPeriod(int64_t value) {
sendToDetector(F_SET_PERIOD, value, nullptr);
if (shm()->useReceiverFlag) {
const int rxIndex = -1;
- sendToReceiver(rxIndex, F_RECEIVER_SET_PERIOD, value, nullptr);
+ sendToReceiver(rxIndex, F_RECEIVER_SET_PERIOD, value, nullptr);
}
}
@@ -586,11 +589,11 @@ void Module::setDynamicRange(int dr) {
if (dr == 32) {
LOG(logINFO) << "Setting Clock to Quarter Speed to cope with "
"Dynamic Range of 32";
- setClockDivider(RUN_CLOCK, 2);
+ setReadoutSpeed(defs::QUARTER_SPEED);
} else {
LOG(logINFO) << "Setting Clock to Full Speed for Dynamic Range of "
<< dr;
- setClockDivider(RUN_CLOCK, 0);
+ setReadoutSpeed(defs::FULL_SPEED);
}
// EIGER only, update speed and rate correction when dr changes
if (dr != prev_val) {
@@ -607,10 +610,18 @@ void Module::setTimingMode(timingMode value) {
sendToDetector(F_SET_TIMING_MODE, value);
if (shm()->useReceiverFlag) {
const int rxIndex = -1;
- sendToReceiver(rxIndex, F_SET_RECEIVER_TIMING_MODE, value, nullptr);
+ sendToReceiver(rxIndex, F_SET_RECEIVER_TIMING_MODE, value, nullptr);
}
}
+slsDetectorDefs::speedLevel Module::getReadoutSpeed() const {
+ return sendToDetector(F_GET_READOUT_SPEED);
+}
+
+void Module::setReadoutSpeed(speedLevel value) {
+ sendToDetector(F_SET_READOUT_SPEED, value, nullptr);
+}
+
int Module::getClockDivider(int clkIndex) const {
return sendToDetector(F_GET_CLOCK_DIVIDER, clkIndex);
}
@@ -758,14 +769,14 @@ void Module::setReadNRows(const int value) {
void Module::startReceiver() {
shm()->stoppedFlag = false;
- const int rxIndex = -1;
- sendToReceiver(rxIndex, F_START_RECEIVER);
+ const int rxIndex = -1;
+ sendToReceiver(rxIndex, F_START_RECEIVER);
}
void Module::stopReceiver() {
- const int rxIndex = -1;
- sendToReceiver(rxIndex, F_STOP_RECEIVER, static_cast(shm()->stoppedFlag),
- nullptr);
+ const int rxIndex = -1;
+ sendToReceiver(rxIndex, F_STOP_RECEIVER,
+ static_cast(shm()->stoppedFlag), nullptr);
}
void Module::startAcquisition() {
@@ -803,8 +814,8 @@ void Module::stopAcquisition() {
}
void Module::restreamStopFromReceiver() {
- const int rxIndex = -1;
- sendToReceiver(rxIndex, F_RESTREAM_STOP_FROM_RECEIVER);
+ const int rxIndex = -1;
+ sendToReceiver(rxIndex, F_RESTREAM_STOP_FROM_RECEIVER);
}
void Module::startAndReadAll() {
@@ -817,17 +828,17 @@ slsDetectorDefs::runStatus Module::getRunStatus() const {
}
slsDetectorDefs::runStatus Module::getReceiverStatus() const {
- const int rxIndex = -1;
+ const int rxIndex = -1;
return sendToReceiver(rxIndex, F_GET_RECEIVER_STATUS);
}
double Module::getReceiverProgress() const {
- const int rxIndex = -1;
+ const int rxIndex = -1;
return sendToReceiver(rxIndex, F_GET_RECEIVER_PROGRESS);
}
int64_t Module::getFramesCaughtByReceiver() const {
- const int rxIndex = -1;
+ const int rxIndex = -1;
return sendToReceiver(rxIndex, F_GET_RECEIVER_FRAMES_CAUGHT);
}
@@ -836,7 +847,8 @@ std::vector Module::getNumMissingPackets() const {
LOG(logDEBUG1) << "Getting num missing packets";
if (shm()->useReceiverFlag) {
const int rxIndex = 0;
- auto client = ReceiverSocket(shm()->receivers[rxIndex].hostname, shm()->receivers[rxIndex].tcpPort);
+ auto client = ReceiverSocket(shm()->receivers[rxIndex].hostname,
+ shm()->receivers[rxIndex].tcpPort);
client.Send(F_GET_NUM_MISSING_PACKETS);
if (client.Receive() == FAIL) {
throw ReceiverError(
@@ -847,7 +859,7 @@ std::vector Module::getNumMissingPackets() const {
std::vector retval(nports);
client.Receive(retval);
LOG(logDEBUG1) << "Missing packets of Receiver" << moduleIndex
- << ": " << sls::ToString(retval);
+ << ": " << sls::ToString(retval);
return retval;
}
}
@@ -874,7 +886,7 @@ void Module::setScan(const defs::scanParameters t) {
auto retval = sendToDetector