mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
clang format
This commit is contained in:
parent
3726ae3fd1
commit
b39c64032d
@ -16,15 +16,14 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
namespace py = pybind11;
|
namespace py = pybind11;
|
||||||
void init_det(py::module &m) {
|
void init_det(py::module &m) {
|
||||||
|
using sls::defs;
|
||||||
using sls::Detector;
|
using sls::Detector;
|
||||||
|
using sls::ns;
|
||||||
using sls::Positions;
|
using sls::Positions;
|
||||||
using sls::Result;
|
using sls::Result;
|
||||||
using sls::defs;
|
|
||||||
using sls::ns;
|
|
||||||
|
|
||||||
py::class_<Detector> CppDetectorApi(m, "CppDetectorApi");
|
py::class_<Detector> CppDetectorApi(m, "CppDetectorApi");
|
||||||
CppDetectorApi
|
CppDetectorApi.def(py::init<int>())
|
||||||
.def(py::init<int>())
|
|
||||||
|
|
||||||
[[FUNCTIONS]]
|
[[FUNCTIONS]]
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#include <pybind11/pybind11.h>
|
#include <pybind11/pybind11.h>
|
||||||
#include <pybind11/stl.h>
|
#include <pybind11/stl.h>
|
||||||
|
|
||||||
#include "sls/sls_detector_defs.h"
|
|
||||||
#include "sls/Pattern.h"
|
#include "sls/Pattern.h"
|
||||||
|
#include "sls/sls_detector_defs.h"
|
||||||
namespace py = pybind11;
|
namespace py = pybind11;
|
||||||
void init_enums(py::module &m) {
|
void init_enums(py::module &m) {
|
||||||
py::class_<slsDetectorDefs> Defs(m, "slsDetectorDefs");
|
py::class_<slsDetectorDefs> Defs(m, "slsDetectorDefs");
|
||||||
|
4
python/src/main.cpp
Executable file → Normal file
4
python/src/main.cpp
Executable file → Normal file
@ -5,15 +5,14 @@
|
|||||||
#include <pybind11/pybind11.h>
|
#include <pybind11/pybind11.h>
|
||||||
#include <pybind11/stl.h>
|
#include <pybind11/stl.h>
|
||||||
|
|
||||||
|
#include "mythenFileIO.h"
|
||||||
#include "sls/Detector.h"
|
#include "sls/Detector.h"
|
||||||
#include "sls/Result.h"
|
#include "sls/Result.h"
|
||||||
#include "mythenFileIO.h"
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "typecaster.h"
|
#include "typecaster.h"
|
||||||
|
|
||||||
|
|
||||||
using ds = std::chrono::duration<double>;
|
using ds = std::chrono::duration<double>;
|
||||||
|
|
||||||
namespace py = pybind11;
|
namespace py = pybind11;
|
||||||
@ -43,7 +42,6 @@ PYBIND11_MODULE(_slsdet, m) {
|
|||||||
init_source(m);
|
init_source(m);
|
||||||
// init_experimental(m);
|
// init_experimental(m);
|
||||||
|
|
||||||
|
|
||||||
py::module io = m.def_submodule("io", "Submodule for io");
|
py::module io = m.def_submodule("io", "Submodule for io");
|
||||||
io.def("read_my302_file", &read_my302_file, "some");
|
io.def("read_my302_file", &read_my302_file, "some");
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ This file contains Python bindings for the IpAddr and MacAddr
|
|||||||
classes.
|
classes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <pybind11/chrono.h>
|
#include <pybind11/chrono.h>
|
||||||
#include <pybind11/operators.h>
|
#include <pybind11/operators.h>
|
||||||
#include <pybind11/pybind11.h>
|
#include <pybind11/pybind11.h>
|
||||||
@ -17,27 +16,25 @@ using sls::IpAddr;
|
|||||||
using sls::MacAddr;
|
using sls::MacAddr;
|
||||||
void init_network(py::module &m) {
|
void init_network(py::module &m) {
|
||||||
|
|
||||||
py::class_ <IpAddr>(m, "IpAddr")
|
py::class_<IpAddr>(m, "IpAddr")
|
||||||
.def(py::init())
|
.def(py::init())
|
||||||
.def(py::init<const std::string&>())
|
.def(py::init<const std::string &>())
|
||||||
.def(py::init<uint32_t>())
|
.def(py::init<uint32_t>())
|
||||||
.def(py::init<const IpAddr&>())
|
.def(py::init<const IpAddr &>())
|
||||||
.def("hex", &IpAddr::hex)
|
.def("hex", &IpAddr::hex)
|
||||||
.def("uint32", &IpAddr::uint32)
|
.def("uint32", &IpAddr::uint32)
|
||||||
.def(py::self == py::self)
|
.def(py::self == py::self)
|
||||||
.def("__repr__", &IpAddr::str)
|
.def("__repr__", &IpAddr::str)
|
||||||
.def("str", &IpAddr::str);
|
.def("str", &IpAddr::str);
|
||||||
|
|
||||||
|
py::class_<MacAddr>(m, "MacAddr")
|
||||||
py::class_ <MacAddr>(m, "MacAddr")
|
|
||||||
.def(py::init())
|
.def(py::init())
|
||||||
.def(py::init<const std::string&>())
|
.def(py::init<const std::string &>())
|
||||||
.def(py::init<uint64_t>())
|
.def(py::init<uint64_t>())
|
||||||
.def(py::init<const MacAddr&>())
|
.def(py::init<const MacAddr &>())
|
||||||
.def("hex", &MacAddr::hex)
|
.def("hex", &MacAddr::hex)
|
||||||
.def(py::self == py::self)
|
.def(py::self == py::self)
|
||||||
.def("uint64", &MacAddr::uint64)
|
.def("uint64", &MacAddr::uint64)
|
||||||
.def("__repr__", &MacAddr::str)
|
.def("__repr__", &MacAddr::str)
|
||||||
.def("str", &MacAddr::str);
|
.def("str", &MacAddr::str);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
#include "sls/sls_detector_defs.h"
|
||||||
#include <pybind11/chrono.h>
|
#include <pybind11/chrono.h>
|
||||||
#include <pybind11/numpy.h>
|
#include <pybind11/numpy.h>
|
||||||
#include <pybind11/operators.h>
|
#include <pybind11/operators.h>
|
||||||
#include <pybind11/pybind11.h>
|
#include <pybind11/pybind11.h>
|
||||||
#include <pybind11/stl.h>
|
#include <pybind11/stl.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "sls/sls_detector_defs.h"
|
|
||||||
namespace py = pybind11;
|
namespace py = pybind11;
|
||||||
void init_scan(py::module &m) {
|
void init_scan(py::module &m) {
|
||||||
|
|
||||||
@ -16,14 +16,15 @@ void init_scan(py::module &m) {
|
|||||||
scanParameters.def(py::init());
|
scanParameters.def(py::init());
|
||||||
|
|
||||||
scanParameters.def(py::init<slsDetectorDefs::dacIndex, int, int, int>());
|
scanParameters.def(py::init<slsDetectorDefs::dacIndex, int, int, int>());
|
||||||
scanParameters.def(py::init<slsDetectorDefs::dacIndex, int, int, int, std::chrono::nanoseconds>());
|
scanParameters.def(py::init<slsDetectorDefs::dacIndex, int, int, int,
|
||||||
|
std::chrono::nanoseconds>());
|
||||||
scanParameters.def_readwrite("enable", &sp::enable);
|
scanParameters.def_readwrite("enable", &sp::enable);
|
||||||
scanParameters.def_readwrite("dacInd", &sp::dacInd);
|
scanParameters.def_readwrite("dacInd", &sp::dacInd);
|
||||||
scanParameters.def_readwrite("startOffset", &sp::startOffset);
|
scanParameters.def_readwrite("startOffset", &sp::startOffset);
|
||||||
scanParameters.def_readwrite("stopOffset", &sp::stopOffset);
|
scanParameters.def_readwrite("stopOffset", &sp::stopOffset);
|
||||||
scanParameters.def_readwrite("stepSize", &sp::stepSize);
|
scanParameters.def_readwrite("stepSize", &sp::stepSize);
|
||||||
scanParameters.def_readwrite("dacSettleTime_ns", &sp::dacSettleTime_ns);
|
scanParameters.def_readwrite("dacSettleTime_ns", &sp::dacSettleTime_ns);
|
||||||
scanParameters.def("__repr__", [](const sp &a){
|
scanParameters.def("__repr__", [](const sp &a) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
auto indent = " ";
|
auto indent = " ";
|
||||||
oss << "<scanParameters>\n";
|
oss << "<scanParameters>\n";
|
||||||
@ -35,7 +36,4 @@ void init_scan(py::module &m) {
|
|||||||
oss << indent << "dacSettleTime_ns: " << a.dacSettleTime_ns;
|
oss << indent << "dacSettleTime_ns: " << a.dacSettleTime_ns;
|
||||||
return oss.str();
|
return oss.str();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <pybind11/pybind11.h>
|
|
||||||
#include "sls/Result.h"
|
#include "sls/Result.h"
|
||||||
|
#include <pybind11/pybind11.h>
|
||||||
// Add type_typecaster to pybind for our wrapper type
|
// Add type_typecaster to pybind for our wrapper type
|
||||||
namespace pybind11 {
|
namespace pybind11 {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
@ -66,14 +66,7 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
NUMSETTINGS
|
NUMSETTINGS
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum { DYNAMIC, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 };
|
||||||
DYNAMIC,
|
|
||||||
FORCE_SWITCH_G1,
|
|
||||||
FORCE_SWITCH_G2,
|
|
||||||
FIX_G1,
|
|
||||||
FIX_G2,
|
|
||||||
FIX_G0
|
|
||||||
};
|
|
||||||
bool isVisibleFixG0{false};
|
bool isVisibleFixG0{false};
|
||||||
|
|
||||||
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
|
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
|
||||||
|
@ -449,13 +449,13 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
|||||||
CATCH_DISPLAY("Could not get client version.",
|
CATCH_DISPLAY("Could not get client version.",
|
||||||
"qDetectorMain::ExecuteHelp")
|
"qDetectorMain::ExecuteHelp")
|
||||||
|
|
||||||
qDefs::Message(qDefs::INFORMATION,
|
qDefs::Message(
|
||||||
|
qDefs::INFORMATION,
|
||||||
"<p style=\"font-family:verdana;\">"
|
"<p style=\"font-family:verdana;\">"
|
||||||
|
|
||||||
"<b>SLS Detector GUI version: " +
|
"<b>SLS Detector GUI version: " +
|
||||||
guiVersion +
|
guiVersion +
|
||||||
"<br>SLS Detector Client version: " +
|
"<br>SLS Detector Client version: " + clientVersion +
|
||||||
clientVersion +
|
|
||||||
"</b><br><br>"
|
"</b><br><br>"
|
||||||
|
|
||||||
"Common GUI to control the SLS Detectors: "
|
"Common GUI to control the SLS Detectors: "
|
||||||
@ -466,17 +466,16 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
|||||||
"line interface: sls_detector_put, sls_detector_get, "
|
"line interface: sls_detector_put, sls_detector_get, "
|
||||||
"sls_detector_acquire and sls_detector_help.<br><br>"
|
"sls_detector_acquire and sls_detector_help.<br><br>"
|
||||||
|
|
||||||
|
|
||||||
"Support:<br>"
|
"Support:<br>"
|
||||||
"Dhanya.Thattil@psi.ch <br>"
|
"Dhanya.Thattil@psi.ch <br>"
|
||||||
"Erik.Froejdh@psi.ch.<br><br><br>"
|
"Erik.Froejdh@psi.ch.<br><br><br>"
|
||||||
|
|
||||||
"<br>slsDetectorGui Copyright (C) 2021 Contributors to SLS Detector Package<br><br>"
|
"<br>slsDetectorGui Copyright (C) 2021 Contributors to SLS "
|
||||||
|
"Detector Package<br><br>"
|
||||||
|
|
||||||
"See COPYING in root folder for Licensing details:<br>"
|
"See COPYING in root folder for Licensing details:<br>"
|
||||||
"LGPL-3.0-or-other"
|
"LGPL-3.0-or-other"
|
||||||
|
|
||||||
|
|
||||||
"<\\p>",
|
"<\\p>",
|
||||||
"qDetectorMain::ExecuteHelp");
|
"qDetectorMain::ExecuteHelp");
|
||||||
}
|
}
|
||||||
|
@ -375,8 +375,8 @@ void qTabDataOutput::GetSpeed() {
|
|||||||
disconnect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
disconnect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetSpeed(int)));
|
SLOT(SetSpeed(int)));
|
||||||
try {
|
try {
|
||||||
auto retval =
|
auto retval = det->getReadoutSpeed().tsquash(
|
||||||
det->getReadoutSpeed().tsquash("Readout Speed is inconsistent for all detectors.");
|
"Readout Speed is inconsistent for all detectors.");
|
||||||
comboClkDivider->setCurrentIndex(static_cast<int>(retval));
|
comboClkDivider->setCurrentIndex(static_cast<int>(retval));
|
||||||
}
|
}
|
||||||
CATCH_DISPLAY("Could not get readout speed.", "qTabDataOutput::GetSpeed")
|
CATCH_DISPLAY("Could not get readout speed.", "qTabDataOutput::GetSpeed")
|
||||||
@ -390,8 +390,8 @@ void qTabDataOutput::SetSpeed(int speed) {
|
|||||||
try {
|
try {
|
||||||
det->setReadoutSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
|
det->setReadoutSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
|
||||||
}
|
}
|
||||||
CATCH_HANDLE("Could not set readout speed.", "qTabDataOutput::SetSpeed", this,
|
CATCH_HANDLE("Could not set readout speed.", "qTabDataOutput::SetSpeed",
|
||||||
&qTabDataOutput::GetSpeed)
|
this, &qTabDataOutput::GetSpeed)
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetParallel() {
|
void qTabDataOutput::GetParallel() {
|
||||||
|
@ -14,7 +14,6 @@ extern int isControlServer;
|
|||||||
|
|
||||||
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
|
||||||
|
|
||||||
|
|
||||||
struct LocalLinkInterface ll_beb_local, *ll_beb;
|
struct LocalLinkInterface ll_beb_local, *ll_beb;
|
||||||
|
|
||||||
struct udp_header_type udp_header;
|
struct udp_header_type udp_header;
|
||||||
@ -47,7 +46,6 @@ int Beb_deactivated_left_datastream = 1;
|
|||||||
int Beb_deactivated_right_datastream = 1;
|
int Beb_deactivated_right_datastream = 1;
|
||||||
int Beb_deactivated_num_destinations = 1;
|
int Beb_deactivated_num_destinations = 1;
|
||||||
|
|
||||||
|
|
||||||
void Beb_Beb() {
|
void Beb_Beb() {
|
||||||
Beb_send_ndata = 0;
|
Beb_send_ndata = 0;
|
||||||
Beb_send_buffer_size = 1026;
|
Beb_send_buffer_size = 1026;
|
||||||
@ -90,7 +88,9 @@ void Beb_Beb() {
|
|||||||
void Beb_ClearHeaderData(int ten_gig) {
|
void Beb_ClearHeaderData(int ten_gig) {
|
||||||
for (int i = 0; i < MAX_UDP_DESTINATION; ++i) {
|
for (int i = 0; i < MAX_UDP_DESTINATION; ++i) {
|
||||||
if (!Beb_SetUpUDPHeader(i, ten_gig, 0, 0, 0, 0, 0, 0)) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,7 +112,8 @@ int Beb_SetUpUDPHeader(unsigned int header_number, int ten_gig,
|
|||||||
else
|
else
|
||||||
bram_phy_addr = 0xC6001000;
|
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;
|
return 0;
|
||||||
|
|
||||||
int fd = Beb_open(&csp0base, bram_phy_addr);
|
int fd = Beb_open(&csp0base, bram_phy_addr);
|
||||||
@ -875,7 +876,8 @@ int Beb_StopAcquisition() {
|
|||||||
return 1;
|
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)
|
if (!Beb_activated)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -899,8 +901,8 @@ int Beb_RequestNImages(int ten_gig, unsigned int nimages, int test_just_send_out
|
|||||||
LOG(logINFO, ("ten_gig:%d, npackets:%d, "
|
LOG(logINFO, ("ten_gig:%d, npackets:%d, "
|
||||||
"Beb_bit_mode:%d, header_size:%d, nimages:%d, "
|
"Beb_bit_mode:%d, header_size:%d, nimages:%d, "
|
||||||
"test_just_send_out_packets_no_wait:%d\n",
|
"test_just_send_out_packets_no_wait:%d\n",
|
||||||
ten_gig, npackets, Beb_bit_mode,
|
ten_gig, npackets, Beb_bit_mode, header_size, nimages,
|
||||||
header_size, nimages, test_just_send_out_packets_no_wait));
|
test_just_send_out_packets_no_wait));
|
||||||
|
|
||||||
u_int32_t right_port_value = 0x2000;
|
u_int32_t right_port_value = 0x2000;
|
||||||
u_int32_t *csp0base = 0;
|
u_int32_t *csp0base = 0;
|
||||||
|
@ -1143,7 +1143,8 @@ int Feb_Control_SoftwareTrigger(int block) {
|
|||||||
// end of acquisition (cannot monitor readyForTrigger)
|
// end of acquisition (cannot monitor readyForTrigger)
|
||||||
int status = Feb_Control_AcquisitionInProgress();
|
int status = Feb_Control_AcquisitionInProgress();
|
||||||
if (status == STATUS_ERROR) {
|
if (status == STATUS_ERROR) {
|
||||||
LOG(logERROR, ("Status: ERROR reading DAQ status register\n"));
|
LOG(logERROR,
|
||||||
|
("Status: ERROR reading DAQ status register\n"));
|
||||||
return 0;
|
return 0;
|
||||||
} else if (status == STATUS_IDLE) {
|
} else if (status == STATUS_IDLE) {
|
||||||
break;
|
break;
|
||||||
@ -1158,7 +1159,9 @@ int Feb_Control_SoftwareTrigger(int block) {
|
|||||||
}
|
}
|
||||||
LOG(logDEBUG2, ("Done waiting (wait for trigger)!\n"));
|
LOG(logDEBUG2, ("Done waiting (wait for trigger)!\n"));
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("%s Software Trigger %s\n", (block ? "Blocking" : "Non blocking"), (block ? "Acquired" : "Sent")));
|
LOG(logINFO,
|
||||||
|
("%s Software Trigger %s\n", (block ? "Blocking" : "Non blocking"),
|
||||||
|
(block ? "Acquired" : "Sent")));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
|
||||||
|
|
||||||
// from Gerd and was called mmap_test.h
|
// from Gerd and was called mmap_test.h
|
||||||
|
|
||||||
#ifndef __PLB_LL_FIFO_H__
|
#ifndef __PLB_LL_FIFO_H__
|
||||||
|
@ -1730,7 +1730,7 @@ int setReadoutSpeed(int val) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getReadoutSpeed(int* retval) {
|
int getReadoutSpeed(int *retval) {
|
||||||
*retval = eiger_readoutspeed;
|
*retval = eiger_readoutspeed;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -2311,14 +2311,11 @@ void *start_timer(void *arg) {
|
|||||||
|
|
||||||
int readNRows = getReadNRows();
|
int readNRows = getReadNRows();
|
||||||
if (readNRows == -1) {
|
if (readNRows == -1) {
|
||||||
LOG(logERROR,
|
LOG(logERROR, ("readNRows is -1. Assuming no readNRows.\n"));
|
||||||
("readNRows is -1. Assuming no readNRows.\n"));
|
|
||||||
readNRows = MAX_ROWS_PER_READOUT;
|
readNRows = MAX_ROWS_PER_READOUT;
|
||||||
}
|
}
|
||||||
const int maxRows = MAX_ROWS_PER_READOUT;
|
const int maxRows = MAX_ROWS_PER_READOUT;
|
||||||
const int packetsPerFrame =
|
const int packetsPerFrame = (maxPacketsPerFrame * readNRows) / maxRows;
|
||||||
(maxPacketsPerFrame * readNRows) / maxRows;
|
|
||||||
|
|
||||||
|
|
||||||
LOG(logDEBUG1,
|
LOG(logDEBUG1,
|
||||||
(" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
|
(" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
|
||||||
@ -2358,19 +2355,16 @@ void *start_timer(void *arg) {
|
|||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||||
eiger_virtual_test_mode ? 0xFFE
|
eiger_virtual_test_mode ? 0xFFE : (uint16_t)pixelVal;
|
||||||
: (uint16_t)pixelVal;
|
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
||||||
eiger_virtual_test_mode ? 0xFFFFFE
|
eiger_virtual_test_mode ? 0xFFFFFE : (uint32_t)pixelVal;
|
||||||
: (uint32_t)pixelVal;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send data
|
// Send data
|
||||||
@ -2404,7 +2398,6 @@ void *start_timer(void *arg) {
|
|||||||
const int startval = 0;
|
const int startval = 0;
|
||||||
const int endval = startval + packetsPerFrame - 1;
|
const int endval = startval + packetsPerFrame - 1;
|
||||||
|
|
||||||
|
|
||||||
// set header
|
// set header
|
||||||
char packetData[packetsize];
|
char packetData[packetsize];
|
||||||
memset(packetData, 0, packetsize);
|
memset(packetData, 0, packetsize);
|
||||||
@ -2466,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);
|
usleep(eiger_virtual_transmission_delay_left);
|
||||||
sendUDPPacket(iRxEntry, 0, packetData, packetsize);
|
sendUDPPacket(iRxEntry, 0, packetData, packetsize);
|
||||||
LOG(logDEBUG1, ("Sent left packet: %d\n", i));
|
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);
|
usleep(eiger_virtual_transmission_delay_right);
|
||||||
sendUDPPacket(iRxEntry, 1, packetData2, packetsize);
|
sendUDPPacket(iRxEntry, 1, packetData2, packetsize);
|
||||||
LOG(logDEBUG1, ("Sent right packet: %d\n", i));
|
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);
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||||
(end.tv_nsec - begin.tv_nsec));
|
(end.tv_nsec - begin.tv_nsec));
|
||||||
|
@ -296,7 +296,8 @@ int getModuleId(int *ret, char *mess) {
|
|||||||
void setModuleId(int modid) {
|
void setModuleId(int modid) {
|
||||||
LOG(logINFOBLUE, ("Setting module id in fpga: %d\n", 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) & ~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() {
|
u_int64_t getDetectorMAC() {
|
||||||
@ -1915,11 +1916,10 @@ int checkDetectorType() {
|
|||||||
int type = atoi(buffer);
|
int type = atoi(buffer);
|
||||||
if (type > TYPE_NO_MODULE_STARTING_VAL) {
|
if (type > TYPE_NO_MODULE_STARTING_VAL) {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("No Module attached! Expected %d, %d or %d for Gotthard2, got %d\n",
|
("No Module attached! Expected %d, %d or %d for Gotthard2, got "
|
||||||
TYPE_GOTTHARD2_MODULE_VAL,
|
"%d\n",
|
||||||
TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL,
|
TYPE_GOTTHARD2_MODULE_VAL, TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL,
|
||||||
TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL,
|
TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL, type));
|
||||||
type));
|
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1927,11 +1927,10 @@ int checkDetectorType() {
|
|||||||
(abs(type - TYPE_GOTTHARD2_25UM_MASTER_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_SLAVE_MODULE_VAL) > TYPE_TOLERANCE)) {
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got %d\n",
|
("Wrong Module attached! Expected %d, %d or %d for Gotthard2, got "
|
||||||
TYPE_GOTTHARD2_MODULE_VAL,
|
"%d\n",
|
||||||
TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL,
|
TYPE_GOTTHARD2_MODULE_VAL, TYPE_GOTTHARD2_25UM_MASTER_MODULE_VAL,
|
||||||
TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL,
|
TYPE_GOTTHARD2_25UM_SLAVE_MODULE_VAL, type));
|
||||||
type));
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
@ -2119,9 +2118,9 @@ int setReadoutSpeed(int val) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getReadoutSpeed(int* retval) {
|
int getReadoutSpeed(int *retval) {
|
||||||
//TODO ASIC and ADIFreg need to check????
|
// TODO ASIC and ADIFreg need to check????
|
||||||
// clkdiv 2, 3, 4, 5?
|
// clkdiv 2, 3, 4, 5?
|
||||||
if (clkDivider[READOUT_C0] == SPEED_108_CLKDIV_0 &&
|
if (clkDivider[READOUT_C0] == SPEED_108_CLKDIV_0 &&
|
||||||
clkDivider[READOUT_C1] == SPEED_108_CLKDIV_1 &&
|
clkDivider[READOUT_C1] == SPEED_108_CLKDIV_1 &&
|
||||||
getPhase(READOUT_C1, 1) == SPEED_108_CLKPHASE_DEG_1) {
|
getPhase(READOUT_C1, 1) == SPEED_108_CLKPHASE_DEG_1) {
|
||||||
|
@ -734,7 +734,9 @@ int readConfigFile() {
|
|||||||
// version 1.1 and HW 1.0 (version reg value = 2) is incompatible
|
// version 1.1 and HW 1.0 (version reg value = 2) is incompatible
|
||||||
if (version == 11 && isHardwareVersion2()) {
|
if (version == 11 && isHardwareVersion2()) {
|
||||||
strcpy(initErrorMessage,
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1352,7 +1354,9 @@ int setNumberofDestinations(int value) {
|
|||||||
LOG(logINFO, ("Setting number of entries to %d\n", value));
|
LOG(logINFO, ("Setting number of entries to %d\n", value));
|
||||||
--value;
|
--value;
|
||||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_RX_ADDTNL_ENDPTS_NUM_MSK);
|
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;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1506,7 +1510,8 @@ int configureMAC() {
|
|||||||
if (iRxEntry < numUdpDestinations) {
|
if (iRxEntry < numUdpDestinations) {
|
||||||
LOG(logINFOBLUE, ("\tEntry %d\n", iRxEntry));
|
LOG(logINFOBLUE, ("\tEntry %d\n", iRxEntry));
|
||||||
|
|
||||||
LOG(logINFO, ("\tOuter %s\n", (numInterfaces == 2)
|
LOG(logINFO,
|
||||||
|
("\tOuter %s\n", (numInterfaces == 2)
|
||||||
? "(Bottom)"
|
? "(Bottom)"
|
||||||
: (selInterface ? "Not Used" : "Used")));
|
: (selInterface ? "Not Used" : "Used")));
|
||||||
LOG(logINFO, ("\tSource IP : %s\n"
|
LOG(logINFO, ("\tSource IP : %s\n"
|
||||||
@ -1517,10 +1522,12 @@ int configureMAC() {
|
|||||||
"\tDest Port : %d\n\n",
|
"\tDest Port : %d\n\n",
|
||||||
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
|
src_ip, src_mac, srcport, dst_ip, dst_mac, dstport));
|
||||||
|
|
||||||
LOG(logINFO, ("\tInner %s\n", (numInterfaces == 2)
|
LOG(logINFO,
|
||||||
|
("\tInner %s\n", (numInterfaces == 2)
|
||||||
? "(Top)"
|
? "(Top)"
|
||||||
: (selInterface ? "Used" : "Not Used")));
|
: (selInterface ? "Used" : "Not Used")));
|
||||||
LOG(logINFO, ("\tSource IP2 : %s\n"
|
LOG(logINFO,
|
||||||
|
("\tSource IP2 : %s\n"
|
||||||
"\tSource MAC2 : %s\n"
|
"\tSource MAC2 : %s\n"
|
||||||
"\tSource Port2: %d\n"
|
"\tSource Port2: %d\n"
|
||||||
"\tDest IP2 : %s\n"
|
"\tDest IP2 : %s\n"
|
||||||
@ -1548,18 +1555,18 @@ int configureMAC() {
|
|||||||
setupHeader(iRxEntry, OUTER, dstip, dstmac, dstport, srcmac, srcip,
|
setupHeader(iRxEntry, OUTER, dstip, dstmac, dstport, srcmac, srcip,
|
||||||
srcport);
|
srcport);
|
||||||
// top
|
// top
|
||||||
setupHeader(iRxEntry, INNER, dstip2, dstmac2, dstport2, srcmac2, srcip2,
|
setupHeader(iRxEntry, INNER, dstip2, dstmac2, dstport2, srcmac2,
|
||||||
srcport2);
|
srcip2, srcport2);
|
||||||
}
|
}
|
||||||
// single interface
|
// single interface
|
||||||
else {
|
else {
|
||||||
// default
|
// default
|
||||||
if (selInterface == 0) {
|
if (selInterface == 0) {
|
||||||
setupHeader(iRxEntry, OUTER, dstip, dstmac, dstport, srcmac, srcip,
|
setupHeader(iRxEntry, OUTER, dstip, dstmac, dstport, srcmac,
|
||||||
srcport);
|
srcip, srcport);
|
||||||
} else {
|
} else {
|
||||||
setupHeader(iRxEntry, INNER, dstip, dstmac, dstport, srcmac, srcip,
|
setupHeader(iRxEntry, INNER, dstip, dstmac, dstport, srcmac,
|
||||||
srcport2);
|
srcip, srcport2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1656,12 +1663,13 @@ int setReadNRows(int value) {
|
|||||||
int regval = (value / READ_N_ROWS_MULTIPLE) - 1;
|
int regval = (value / READ_N_ROWS_MULTIPLE) - 1;
|
||||||
uint32_t addr = READ_N_ROWS_REG;
|
uint32_t addr = READ_N_ROWS_REG;
|
||||||
LOG(logINFO, ("Setting number of rows: %d (regval:%d)\n", value, regval));
|
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) & ~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) | ((regval << READ_N_ROWS_NUM_ROWS_OFST) &
|
||||||
|
READ_N_ROWS_NUM_ROWS_MSK));
|
||||||
|
|
||||||
if (value == MAX_ROWS_PER_READOUT) {
|
if (value == MAX_ROWS_PER_READOUT) {
|
||||||
LOG(logINFO, ("Disabling Partial Readout (#rows)\n"));
|
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 {
|
} else {
|
||||||
LOG(logINFO, ("Enabling Partial Readout (#rows)\n"));
|
LOG(logINFO, ("Enabling 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);
|
||||||
@ -1671,9 +1679,10 @@ int setReadNRows(int value) {
|
|||||||
|
|
||||||
int getReadNRows() {
|
int getReadNRows() {
|
||||||
int enable = (bus_r(READ_N_ROWS_REG) & READ_N_ROWS_ENBL_MSK);
|
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 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 maxRegval = (MAX_ROWS_PER_READOUT / READ_N_ROWS_MULTIPLE) - 1;
|
||||||
if ((regval == maxRegval && enable) || (regval != maxRegval && !enable)) {
|
if ((regval == maxRegval && enable) || (regval != maxRegval && !enable)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1742,9 +1751,7 @@ int powerChip(int on) {
|
|||||||
CHIP_POWER_STATUS_OFST);
|
CHIP_POWER_STATUS_OFST);
|
||||||
}
|
}
|
||||||
|
|
||||||
int isChipConfigured() {
|
int isChipConfigured() { return chipConfigured; }
|
||||||
return chipConfigured;
|
|
||||||
}
|
|
||||||
|
|
||||||
void configureChip() {
|
void configureChip() {
|
||||||
// only for chipv1.1 and chip is powered on
|
// only for chipv1.1 and chip is powered on
|
||||||
@ -1771,7 +1778,6 @@ void configureChip() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int autoCompDisable(int on) {
|
int autoCompDisable(int on) {
|
||||||
if (on != -1) {
|
if (on != -1) {
|
||||||
if (on) {
|
if (on) {
|
||||||
@ -1922,7 +1928,7 @@ int setReadoutSpeed(int val) {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getReadoutSpeed(int* retval) {
|
int getReadoutSpeed(int *retval) {
|
||||||
u_int32_t speed = bus_r(CONFIG_REG) & CONFIG_READOUT_SPEED_MSK;
|
u_int32_t speed = bus_r(CONFIG_REG) & CONFIG_READOUT_SPEED_MSK;
|
||||||
switch (speed) {
|
switch (speed) {
|
||||||
case CONFIG_FULL_SPEED_40MHZ_VAL:
|
case CONFIG_FULL_SPEED_40MHZ_VAL:
|
||||||
@ -2191,7 +2197,8 @@ int getFilterCell() {
|
|||||||
#else
|
#else
|
||||||
uint32_t addr = CONFIG_V11_STATUS_REG;
|
uint32_t addr = CONFIG_V11_STATUS_REG;
|
||||||
#endif
|
#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
|
// count number of bits = which icell
|
||||||
return (__builtin_popcount(value));
|
return (__builtin_popcount(value));
|
||||||
}
|
}
|
||||||
@ -2202,7 +2209,7 @@ void setFilterCell(int iCell) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t addr = CONFIG_V11_REG;
|
uint32_t addr = CONFIG_V11_REG;
|
||||||
bus_w(addr, bus_r(addr) &~ CONFIG_V11_FLTR_CLL_MSK);
|
bus_w(addr, bus_r(addr) & ~CONFIG_V11_FLTR_CLL_MSK);
|
||||||
|
|
||||||
if (iCell > 0) {
|
if (iCell > 0) {
|
||||||
// enables as many cells
|
// enables as many cells
|
||||||
@ -2210,9 +2217,11 @@ void setFilterCell(int iCell) {
|
|||||||
for (int i = 0; i != iCell; ++i) {
|
for (int i = 0; i != iCell; ++i) {
|
||||||
value |= (1 << i);
|
value |= (1 << i);
|
||||||
}
|
}
|
||||||
bus_w(addr, bus_r(addr) | ((value << CONFIG_V11_FLTR_CLL_OFST) & 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)));
|
LOG(logINFO,
|
||||||
|
("Setting Filter Cell to %d [Reg:0x%x]\n", iCell, bus_r(addr)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void disableCurrentSource() {
|
void disableCurrentSource() {
|
||||||
@ -2239,8 +2248,8 @@ void enableCurrentSource(int fix, uint64_t select, int normal) {
|
|||||||
(long unsigned int)select));
|
(long unsigned int)select));
|
||||||
} else {
|
} else {
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Enabling current source [fix:%d, select:%ld, normal:%d]\n",
|
("Enabling current source [fix:%d, select:%ld, normal:%d]\n", fix,
|
||||||
fix, (long int)select, normal));
|
(long int)select, normal));
|
||||||
}
|
}
|
||||||
// fix
|
// fix
|
||||||
if (fix) {
|
if (fix) {
|
||||||
@ -2270,7 +2279,7 @@ void enableCurrentSource(int fix, uint64_t select, int normal) {
|
|||||||
inverted |= (bit << (63 - i));
|
inverted |= (bit << (63 - i));
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("\tSetting selection to 0x%lx (inverted from 0x%lx)\n",
|
LOG(logINFO, ("\tSetting selection to 0x%lx (inverted from 0x%lx)\n",
|
||||||
(long unsigned int) inverted, (long unsigned int)select));
|
(long unsigned int)inverted, (long unsigned int)select));
|
||||||
set64BitReg(inverted, CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG);
|
set64BitReg(inverted, CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG);
|
||||||
|
|
||||||
// normal
|
// normal
|
||||||
@ -2326,7 +2335,8 @@ uint64_t getSelectCurrentSource() {
|
|||||||
DAQ_CRRNT_SRC_CLMN_SLCT_OFST);
|
DAQ_CRRNT_SRC_CLMN_SLCT_OFST);
|
||||||
} else {
|
} else {
|
||||||
// invert the select
|
// invert the select
|
||||||
uint64_t retval = get64BitReg(CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG);
|
uint64_t retval =
|
||||||
|
get64BitReg(CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG);
|
||||||
|
|
||||||
uint64_t tmp = retval;
|
uint64_t tmp = retval;
|
||||||
uint64_t inverted = 0;
|
uint64_t inverted = 0;
|
||||||
@ -2541,11 +2551,13 @@ void *start_timer(void *arg) {
|
|||||||
|
|
||||||
if (i >= startval && i <= endval) {
|
if (i >= startval && i <= endval) {
|
||||||
sendUDPPacket(iRxEntry, 1, packetData2, packetsize);
|
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);
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||||
(end.tv_nsec - begin.tv_nsec));
|
(end.tv_nsec - begin.tv_nsec));
|
||||||
|
@ -1581,7 +1581,6 @@ int getADCPipeline() {
|
|||||||
ADC_OFFSET_ADC_PPLN_OFST);
|
ADC_OFFSET_ADC_PPLN_OFST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* aquisition */
|
/* aquisition */
|
||||||
|
|
||||||
int startStateMachine() {
|
int startStateMachine() {
|
||||||
|
@ -92,7 +92,7 @@ patternParameters *setChipStatusRegisterPattern(int csr) {
|
|||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
pat->word[iaddr++] = patword;
|
pat->word[iaddr++] = patword;
|
||||||
//#This version of the serializer pushes in the MSB first (compatible with
|
//#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--) {
|
for (int ib = nbits - 1; ib >= 0; ib--) {
|
||||||
if (csr & (1 << ib))
|
if (csr & (1 << ib))
|
||||||
patword = setBit(SIGNAL_serialIN, patword);
|
patword = setBit(SIGNAL_serialIN, patword);
|
||||||
|
@ -33,8 +33,7 @@
|
|||||||
#define SIGNAL_CHSclk (24)
|
#define SIGNAL_CHSclk (24)
|
||||||
#define SIGNAL_exposing (25)
|
#define SIGNAL_exposing (25)
|
||||||
|
|
||||||
|
// CHIP STARTUS REGISTER BITS
|
||||||
//CHIP STARTUS REGISTER BITS
|
|
||||||
#define CSR_spypads 0
|
#define CSR_spypads 0
|
||||||
#define CSR_invpol 4
|
#define CSR_invpol 4
|
||||||
#define CSR_dpulse 5
|
#define CSR_dpulse 5
|
||||||
@ -45,13 +44,16 @@
|
|||||||
#define CSR_C15sh 10
|
#define CSR_C15sh 10
|
||||||
#define CSR_C30sh 11 //#default
|
#define CSR_C30sh 11 //#default
|
||||||
#define CSR_C50sh 12
|
#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_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_C15pre 14 // negative polarity
|
||||||
|
|
||||||
#define CSR_default (1<<_CSR_C10pre )|(1<< CSR_C30sh)
|
#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 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 setBit(int ibit, int patword);
|
||||||
int clearBit(int ibit, int patword);
|
int clearBit(int ibit, int patword);
|
||||||
|
@ -283,7 +283,6 @@ u_int32_t getDetectorNumber() {
|
|||||||
return bus_r(MCB_SERIAL_NO_REG);
|
return bus_r(MCB_SERIAL_NO_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getModuleId(int *ret, char *mess) {
|
int getModuleId(int *ret, char *mess) {
|
||||||
return ((bus_r(MOD_ID_REG) & MOD_ID_MSK) >> MOD_ID_OFST);
|
return ((bus_r(MOD_ID_REG) & MOD_ID_MSK) >> MOD_ID_OFST);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,8 @@ void NotifyServerStartSuccess();
|
|||||||
/** reset fpga and controller(only implemented for >= v1.1 boards) */
|
/** reset fpga and controller(only implemented for >= v1.1 boards) */
|
||||||
void rebootControllerAndFPGA();
|
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 getDrive(char *mess);
|
||||||
int openFileForFlash(FILE **flashfd, char *mess);
|
int openFileForFlash(FILE **flashfd, char *mess);
|
||||||
int eraseFlash(char *mess);
|
int eraseFlash(char *mess);
|
||||||
|
@ -473,7 +473,7 @@ int setComparatorDisableTime(int64_t val);
|
|||||||
int64_t getComparatorDisableTime();
|
int64_t getComparatorDisableTime();
|
||||||
void configureASICTimer();
|
void configureASICTimer();
|
||||||
int setReadoutSpeed(int val);
|
int setReadoutSpeed(int val);
|
||||||
int getReadoutSpeed(int* retval);
|
int getReadoutSpeed(int *retval);
|
||||||
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
||||||
int getPhase(enum CLKINDEX ind, int degrees);
|
int getPhase(enum CLKINDEX ind, int degrees);
|
||||||
int getMaxPhase(enum CLKINDEX ind);
|
int getMaxPhase(enum CLKINDEX ind);
|
||||||
@ -498,7 +498,7 @@ uint64_t getSelectCurrentSource();
|
|||||||
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter
|
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter
|
||||||
#elif EIGERD
|
#elif EIGERD
|
||||||
int setReadoutSpeed(int val);
|
int setReadoutSpeed(int val);
|
||||||
int getReadoutSpeed(int* retval);
|
int getReadoutSpeed(int *retval);
|
||||||
int setIODelay(int val);
|
int setIODelay(int val);
|
||||||
int setCounterBit(int val);
|
int setCounterBit(int val);
|
||||||
int pulsePixel(int n, int x, int y);
|
int pulsePixel(int n, int x, int y);
|
||||||
@ -551,7 +551,7 @@ int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval);
|
|||||||
int getFrequency(enum CLKINDEX ind);
|
int getFrequency(enum CLKINDEX ind);
|
||||||
int getVCOFrequency(enum CLKINDEX ind);
|
int getVCOFrequency(enum CLKINDEX ind);
|
||||||
int setReadoutSpeed(int val);
|
int setReadoutSpeed(int val);
|
||||||
int getReadoutSpeed(int* retval);
|
int getReadoutSpeed(int *retval);
|
||||||
int getMaxClockDivider();
|
int getMaxClockDivider();
|
||||||
int setClockDivider(enum CLKINDEX ind, int val);
|
int setClockDivider(enum CLKINDEX ind, int val);
|
||||||
int getClockDivider(enum CLKINDEX ind);
|
int getClockDivider(enum CLKINDEX ind);
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h> // readlink
|
#include <unistd.h> // readlink
|
||||||
|
|
||||||
|
|
||||||
int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin,
|
int ConvertToDifferentRange(int inputMin, int inputMax, int outputMin,
|
||||||
int outputMax, int inputValue, int *outputValue) {
|
int outputMax, int inputValue, int *outputValue) {
|
||||||
LOG(logDEBUG1, (" Input Value: %d (Input:(%d - %d), Output:(%d - %d))\n",
|
LOG(logDEBUG1, (" Input Value: %d (Input:(%d - %d), Output:(%d - %d))\n",
|
||||||
@ -245,7 +244,8 @@ int verifyChecksumFromFlash(char *mess, char *clientChecksum, char *fname,
|
|||||||
|
|
||||||
// read only until a particular size (drive)
|
// read only until a particular size (drive)
|
||||||
if (fsize != 0 && totalBytesRead >= fsize) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
bytes = fread(buf, 1, readUnitSize, fp);
|
bytes = fread(buf, 1, readUnitSize, fp);
|
||||||
|
@ -30,8 +30,9 @@ void setupUDPCommParameters() {
|
|||||||
memset(udpDestinationIp, 0, sizeof(udpDestinationIp));
|
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,
|
int setUDPDestinationDetails(int iRxEntry, int index, const char *ip,
|
||||||
unsigned short int port) {
|
unsigned short int port) {
|
||||||
@ -62,16 +63,20 @@ int setUDPDestinationDetails(int iRxEntry, int index, const char *ip,
|
|||||||
int err = getaddrinfo(udpDestinationIp[iRxEntry][index], sport, &hints,
|
int err = getaddrinfo(udpDestinationIp[iRxEntry][index], sport, &hints,
|
||||||
&udpServerAddrInfo[iRxEntry][index]);
|
&udpServerAddrInfo[iRxEntry][index]);
|
||||||
if (err != 0) {
|
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",
|
"(Error code:%d, %s)\n",
|
||||||
udpDestinationIp[iRxEntry][index], udpDestinationPort[iRxEntry][index], iRxEntry, err,
|
udpDestinationIp[iRxEntry][index],
|
||||||
|
udpDestinationPort[iRxEntry][index], iRxEntry, err,
|
||||||
gai_strerror(err)));
|
gai_strerror(err)));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if (udpServerAddrInfo[iRxEntry][index] == NULL) {
|
if (udpServerAddrInfo[iRxEntry][index] == NULL) {
|
||||||
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]."
|
||||||
"(getaddrinfo returned NULL)\n",
|
"(getaddrinfo returned NULL)\n",
|
||||||
udpDestinationIp[iRxEntry][index], udpDestinationPort[iRxEntry][index], iRxEntry));
|
udpDestinationIp[iRxEntry][index],
|
||||||
|
udpDestinationPort[iRxEntry][index], iRxEntry));
|
||||||
udpServerAddrInfo[iRxEntry][index] = 0;
|
udpServerAddrInfo[iRxEntry][index] = 0;
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -83,38 +88,48 @@ int createUDPSocket(int index) {
|
|||||||
|
|
||||||
for (int iRxEntry = 0; iRxEntry != numUdpDestinations; ++iRxEntry) {
|
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])) {
|
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;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (udpSockfd[iRxEntry][index] != -1) {
|
if (udpSockfd[iRxEntry][index] != -1) {
|
||||||
LOG(logERROR, ("Strange that Udp socket was still open [socket:%d, entry:%d]. Closing it to "
|
LOG(logERROR, ("Strange that Udp socket was still open [socket:%d, "
|
||||||
"create a new one.\n", index, iRxEntry));
|
"entry:%d]. Closing it to "
|
||||||
|
"create a new one.\n",
|
||||||
|
index, iRxEntry));
|
||||||
close(udpSockfd[iRxEntry][index]);
|
close(udpSockfd[iRxEntry][index]);
|
||||||
udpSockfd[iRxEntry][index] = -1;
|
udpSockfd[iRxEntry][index] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creating socket file descriptor
|
// Creating socket file descriptor
|
||||||
udpSockfd[iRxEntry][index] = socket(udpServerAddrInfo[iRxEntry][index]->ai_family,
|
udpSockfd[iRxEntry][index] =
|
||||||
|
socket(udpServerAddrInfo[iRxEntry][index]->ai_family,
|
||||||
udpServerAddrInfo[iRxEntry][index]->ai_socktype,
|
udpServerAddrInfo[iRxEntry][index]->ai_socktype,
|
||||||
udpServerAddrInfo[iRxEntry][index]->ai_protocol);
|
udpServerAddrInfo[iRxEntry][index]->ai_protocol);
|
||||||
if (udpSockfd[iRxEntry][index] == -1) {
|
if (udpSockfd[iRxEntry][index] == -1) {
|
||||||
LOG(logERROR, ("UDP socket at port %d failed [entry:%d]. (Error code:%d, %s)\n",
|
LOG(logERROR, ("UDP socket at port %d failed [entry:%d]. (Error "
|
||||||
udpDestinationPort[iRxEntry][index], iRxEntry, errno, gai_strerror(errno)));
|
"code:%d, %s)\n",
|
||||||
|
udpDestinationPort[iRxEntry][index], iRxEntry, errno,
|
||||||
|
gai_strerror(errno)));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Udp client socket created for server (entry:%d, port %d, ip:%s)\n",
|
LOG(logINFO, ("Udp client socket created for server (entry:%d, port "
|
||||||
iRxEntry, udpDestinationPort[iRxEntry][index], udpDestinationIp[iRxEntry][index]));
|
"%d, ip:%s)\n",
|
||||||
|
iRxEntry, udpDestinationPort[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]));
|
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;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -125,8 +140,8 @@ int sendUDPPacket(int iRxEntry, int index, const char *buf, int length) {
|
|||||||
udpServerAddrInfo[iRxEntry][index]->ai_addrlen);
|
udpServerAddrInfo[iRxEntry][index]->ai_addrlen);
|
||||||
// udp sends atomically, no need to handle partial data
|
// udp sends atomically, no need to handle partial data
|
||||||
if (n == -1) {
|
if (n == -1) {
|
||||||
LOG(logERROR,
|
LOG(logERROR, ("Could not send udp packet for socket %d [entry:%d]. "
|
||||||
("Could not send udp packet for socket %d [entry:%d]. (Error code:%d, %s)\n",
|
"(Error code:%d, %s)\n",
|
||||||
index, iRxEntry, errno, gai_strerror(errno)));
|
index, iRxEntry, errno, gai_strerror(errno)));
|
||||||
} else {
|
} else {
|
||||||
LOG(logDEBUG2, ("%d bytes sent\n", n));
|
LOG(logDEBUG2, ("%d bytes sent\n", n));
|
||||||
|
@ -70,7 +70,7 @@ template <class T, class Allocator = std::allocator<T>> class Result {
|
|||||||
* @tparam Args template paramter pack to forward
|
* @tparam Args template paramter pack to forward
|
||||||
*/
|
*/
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
Result(Args &&... args) : vec(std::forward<Args>(args)...) {}
|
Result(Args &&...args) : vec(std::forward<Args>(args)...) {}
|
||||||
|
|
||||||
using value_type = typename std::vector<T>::value_type;
|
using value_type = typename std::vector<T>::value_type;
|
||||||
using iterator = typename std::vector<T>::iterator;
|
using iterator = typename std::vector<T>::iterator;
|
||||||
|
@ -1209,10 +1209,10 @@ class CmdProxy {
|
|||||||
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench]"
|
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench]"
|
||||||
"Serial number of detector.");
|
"Serial number of detector.");
|
||||||
|
|
||||||
GET_COMMAND(
|
GET_COMMAND(moduleid, getModuleId,
|
||||||
moduleid, getModuleId,
|
|
||||||
"\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) "
|
"\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.");
|
"that is streamed out in the UDP header of the detector. "
|
||||||
|
"Picked up from a file on the module.");
|
||||||
|
|
||||||
GET_COMMAND(type, getDetectorType,
|
GET_COMMAND(type, getDetectorType,
|
||||||
"\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, "
|
"\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, "
|
||||||
@ -1332,10 +1332,10 @@ class CmdProxy {
|
|||||||
GET_COMMAND_NOID(timinglist, getTimingModeList,
|
GET_COMMAND_NOID(timinglist, getTimingModeList,
|
||||||
"\n\tGets the list of timing modes for this detector.");
|
"\n\tGets the list of timing modes for this detector.");
|
||||||
|
|
||||||
GET_COMMAND_NOID(readoutspeedlist, getReadoutSpeedList,
|
GET_COMMAND_NOID(
|
||||||
|
readoutspeedlist, getReadoutSpeedList,
|
||||||
"\n\tList of readout speed levels implemented for this detector.");
|
"\n\tList of readout speed levels implemented for this detector.");
|
||||||
|
|
||||||
|
|
||||||
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
||||||
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of "
|
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of "
|
||||||
"ADC clock.");
|
"ADC clock.");
|
||||||
@ -1357,7 +1357,8 @@ class CmdProxy {
|
|||||||
"the chip. \n\t[Moench] Default is 0. \n\t[Jungfrau] Default is 0. Get "
|
"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 "
|
"will return power status. Can be off if temperature event occured "
|
||||||
"(temperature over temp_threshold with temp_control "
|
"(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.");
|
"connected or wrong module, powerchip will fail.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
@ -1390,7 +1391,10 @@ class CmdProxy {
|
|||||||
readnrows, getReadNRows, setReadNRows, StringTo<int>,
|
readnrows, getReadNRows, setReadNRows, StringTo<int>,
|
||||||
"\n\t[1-256]\n\t\t[Eiger] Number of rows to readout per half module "
|
"\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 "
|
"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 */
|
/** temperature */
|
||||||
GET_COMMAND_NOID(
|
GET_COMMAND_NOID(
|
||||||
@ -1545,7 +1549,8 @@ class CmdProxy {
|
|||||||
"[0, 1]\n\t[Jungfrau] The udp interface to stream data from detector. "
|
"[0, 1]\n\t[Jungfrau] The udp interface to stream data from detector. "
|
||||||
"Effective only when number of interfaces is 1. Default: 0 (outer)");
|
"Effective only when number of interfaces is 1. Default: 0 (outer)");
|
||||||
|
|
||||||
GET_COMMAND(udp_numdst, getNumberofUDPDestinations,
|
GET_COMMAND(
|
||||||
|
udp_numdst, getNumberofUDPDestinations,
|
||||||
"\n\t[Jungfrau][Eiger] One can enter upto 32 "
|
"\n\t[Jungfrau][Eiger] One can enter upto 32 "
|
||||||
"destinations that the detector will stream images "
|
"destinations that the detector will stream images "
|
||||||
"out in a round robin fashion. This is get only command. Default: 1");
|
"out in a round robin fashion. This is get only command. Default: 1");
|
||||||
@ -1556,7 +1561,8 @@ class CmdProxy {
|
|||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
udp_firstdst, getFirstUDPDestination, setFirstUDPDestination,
|
udp_firstdst, getFirstUDPDestination, setFirstUDPDestination,
|
||||||
StringTo<int>,
|
StringTo<int>,
|
||||||
"[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 "
|
"destination that the detector will stream images "
|
||||||
"out from in a round robin fashion. The entry must not have been "
|
"out from in a round robin fashion. The entry must not have been "
|
||||||
"empty. Default: 0");
|
"empty. Default: 0");
|
||||||
@ -1864,10 +1870,9 @@ class CmdProxy {
|
|||||||
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub "
|
"[(optional unit) ns|us|ms|s]\n\t[Eiger] Measured sub "
|
||||||
"frame period between last sub frame and previous one.");
|
"frame period between last sub frame and previous one.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_VEC_ID(activate, getActive, setActive, StringTo<int>,
|
||||||
INTEGER_COMMAND_VEC_ID(
|
"[0, 1] \n\t[Eiger] 1 is default. 0 deactivates "
|
||||||
activate, getActive, setActive, StringTo<int>,
|
"readout and does not send data.");
|
||||||
"[0, 1] \n\t[Eiger] 1 is default. 0 deactivates readout and does not send data.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
partialreset, getPartialReset, setPartialReset, StringTo<int>,
|
partialreset, getPartialReset, setPartialReset, StringTo<int>,
|
||||||
@ -1920,7 +1925,8 @@ class CmdProxy {
|
|||||||
INTEGER_COMMAND_SET_NOID_GET_ID(
|
INTEGER_COMMAND_SET_NOID_GET_ID(
|
||||||
storagecells, getNumberOfAdditionalStorageCells,
|
storagecells, getNumberOfAdditionalStorageCells,
|
||||||
setNumberOfAdditionalStorageCells, StringTo<int>,
|
setNumberOfAdditionalStorageCells, StringTo<int>,
|
||||||
"[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 "
|
"0. For advanced users only. \n\tThe #images = #frames x #triggers x "
|
||||||
"(#storagecells + 1).");
|
"(#storagecells + 1).");
|
||||||
|
|
||||||
@ -1928,13 +1934,15 @@ class CmdProxy {
|
|||||||
storagecell_start, getStorageCellStart, setStorageCellStart,
|
storagecell_start, getStorageCellStart, setStorageCellStart,
|
||||||
StringTo<int>,
|
StringTo<int>,
|
||||||
"[0-max]\n\t[Jungfrau] Storage cell that stores the first acquisition "
|
"[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(
|
TIME_COMMAND(
|
||||||
storagecell_delay, getStorageCellDelay, setStorageCellDelay,
|
storagecell_delay, getStorageCellDelay, setStorageCellDelay,
|
||||||
"[duration (0-1638375 ns)] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] "
|
"[duration (0-1638375 ns)] [(optional unit) ns|us|ms|s]\n\t[Jungfrau] "
|
||||||
"Additional time delay between 2 consecutive exposures in burst mode "
|
"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(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
gainmode, getGainMode, setGainMode,
|
gainmode, getGainMode, setGainMode,
|
||||||
@ -1943,9 +1951,10 @@ class CmdProxy {
|
|||||||
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, "
|
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, "
|
||||||
"you can damage the detector!!!");
|
"you can damage the detector!!!");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(filtercell, getFilterCell, setFilterCell,
|
||||||
filtercell, getFilterCell, setFilterCell, sls::StringTo<int>,
|
sls::StringTo<int>,
|
||||||
"[0-12]\n\t[Jungfrau] Set Filter Cell. Only for chipv1.1. Advanced user Command");
|
"[0-12]\n\t[Jungfrau] Set Filter Cell. Only for "
|
||||||
|
"chipv1.1. Advanced user Command");
|
||||||
|
|
||||||
/* Gotthard Specific */
|
/* Gotthard Specific */
|
||||||
TIME_GET_COMMAND(exptimel, getExptimeLeft,
|
TIME_GET_COMMAND(exptimel, getExptimeLeft,
|
||||||
|
@ -422,23 +422,19 @@ void Detector::setReadoutSpeed(defs::speedLevel value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setReadoutSpeed, pos, value);
|
pimpl->Parallel(&Module::setReadoutSpeed, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::vector<defs::speedLevel> Detector::getReadoutSpeedList() const {
|
std::vector<defs::speedLevel> Detector::getReadoutSpeedList() const {
|
||||||
switch (getDetectorType().squash()) {
|
switch (getDetectorType().squash()) {
|
||||||
case defs::EIGER:
|
case defs::EIGER:
|
||||||
case defs::JUNGFRAU:
|
case defs::JUNGFRAU:
|
||||||
return std::vector<defs::speedLevel>{defs::FULL_SPEED,
|
return std::vector<defs::speedLevel>{defs::FULL_SPEED, defs::HALF_SPEED,
|
||||||
defs::HALF_SPEED,
|
|
||||||
defs::QUARTER_SPEED};
|
defs::QUARTER_SPEED};
|
||||||
case defs::GOTTHARD2:
|
case defs::GOTTHARD2:
|
||||||
return std::vector<defs::speedLevel>{defs::G2_108MHZ,
|
return std::vector<defs::speedLevel>{defs::G2_108MHZ, defs::G2_144MHZ};
|
||||||
defs::G2_144MHZ};
|
|
||||||
default:
|
default:
|
||||||
throw RuntimeError("Readout speed not implemented for this detector");
|
throw RuntimeError("Readout speed not implemented for this detector");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result<int> Detector::getADCPhase(Positions pos) const {
|
Result<int> Detector::getADCPhase(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getClockPhase, pos, defs::ADC_CLOCK, false);
|
return pimpl->Parallel(&Module::getClockPhase, pos, defs::ADC_CLOCK, false);
|
||||||
}
|
}
|
||||||
@ -670,10 +666,6 @@ void Detector::setDefaultDac(defs::dacIndex index, int defaultValue,
|
|||||||
pimpl->setDefaultDac(index, defaultValue, sett, pos);
|
pimpl->setDefaultDac(index, defaultValue, sett, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Detector::resetToDefaultDacs(const bool hardReset, Positions pos) {
|
void Detector::resetToDefaultDacs(const bool hardReset, Positions pos) {
|
||||||
pimpl->Parallel(&Module::resetToDefaultDacs, pos, hardReset);
|
pimpl->Parallel(&Module::resetToDefaultDacs, pos, hardReset);
|
||||||
}
|
}
|
||||||
@ -1439,7 +1431,6 @@ void Detector::setActive(const bool active, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setActivate, pos, active);
|
pimpl->Parallel(&Module::setActivate, pos, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result<bool> Detector::getPartialReset(Positions pos) const {
|
Result<bool> Detector::getPartialReset(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getCounterBit, pos);
|
return pimpl->Parallel(&Module::getCounterBit, pos);
|
||||||
}
|
}
|
||||||
@ -1554,12 +1545,9 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
|
|||||||
std::vector<defs::gainMode> Detector::getGainModeList() const {
|
std::vector<defs::gainMode> Detector::getGainModeList() const {
|
||||||
switch (getDetectorType().squash()) {
|
switch (getDetectorType().squash()) {
|
||||||
case defs::JUNGFRAU:
|
case defs::JUNGFRAU:
|
||||||
return std::vector<defs::gainMode>{defs::DYNAMIC,
|
return std::vector<defs::gainMode>{
|
||||||
defs::FORCE_SWITCH_G1,
|
defs::DYNAMIC, defs::FORCE_SWITCH_G1, defs::FORCE_SWITCH_G2,
|
||||||
defs::FORCE_SWITCH_G2,
|
defs::FIX_G1, defs::FIX_G2, defs::FIX_G0};
|
||||||
defs::FIX_G1,
|
|
||||||
defs::FIX_G2,
|
|
||||||
defs::FIX_G0};
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError("Gain mode is not implemented for this detector.");
|
throw RuntimeError("Gain mode is not implemented for this detector.");
|
||||||
@ -1706,16 +1694,19 @@ Result<defs::streamingInterface> Detector::getVetoStream(Positions pos) const {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setVetoStream(defs::streamingInterface interface, Positions pos) {
|
void Detector::setVetoStream(defs::streamingInterface interface,
|
||||||
|
Positions pos) {
|
||||||
// 3gbe
|
// 3gbe
|
||||||
bool LOW_LATENCY_LINK = ((interface & defs::streamingInterface::LOW_LATENCY_LINK) ==
|
bool LOW_LATENCY_LINK =
|
||||||
|
((interface & defs::streamingInterface::LOW_LATENCY_LINK) ==
|
||||||
defs::streamingInterface::LOW_LATENCY_LINK);
|
defs::streamingInterface::LOW_LATENCY_LINK);
|
||||||
pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK);
|
pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK);
|
||||||
|
|
||||||
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
||||||
int old_numinterfaces = pimpl->getNumberofUDPInterfaces(pos).tsquash(
|
int old_numinterfaces = pimpl->getNumberofUDPInterfaces(pos).tsquash(
|
||||||
"retrieved inconsistent number of udp interfaces");
|
"retrieved inconsistent number of udp interfaces");
|
||||||
int numinterfaces = (((interface & defs::streamingInterface::ETHERNET_10GB) ==
|
int numinterfaces =
|
||||||
|
(((interface & defs::streamingInterface::ETHERNET_10GB) ==
|
||||||
defs::streamingInterface::ETHERNET_10GB)
|
defs::streamingInterface::ETHERNET_10GB)
|
||||||
? 2
|
? 2
|
||||||
: 1);
|
: 1);
|
||||||
|
@ -291,7 +291,9 @@ void DetectorImpl::updateDetectorSize() {
|
|||||||
const slsDetectorDefs::xy det_size = modules[0]->getNumberOfChannels();
|
const slsDetectorDefs::xy det_size = modules[0]->getNumberOfChannels();
|
||||||
|
|
||||||
if (det_size.x == 0 || det_size.y == 0) {
|
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;
|
int maxx = shm()->numberOfChannels.x;
|
||||||
@ -1094,13 +1096,13 @@ int DetectorImpl::acquire() {
|
|||||||
// start and read all
|
// start and read all
|
||||||
try {
|
try {
|
||||||
if (detector_type == defs::MYTHEN3 && modules.size() > 1) {
|
if (detector_type == defs::MYTHEN3 && modules.size() > 1) {
|
||||||
//Multi module mythen
|
// Multi module mythen
|
||||||
std::vector<int> master;
|
std::vector<int> master;
|
||||||
std::vector<int> slaves;
|
std::vector<int> slaves;
|
||||||
auto is_master = Parallel(&Module::isMaster, {});
|
auto is_master = Parallel(&Module::isMaster, {});
|
||||||
slaves.reserve(modules.size() - 1); // check this one!!
|
slaves.reserve(modules.size() - 1); // check this one!!
|
||||||
for (size_t i = 0; i < modules.size(); ++i) {
|
for (size_t i = 0; i < modules.size(); ++i) {
|
||||||
if(is_master[i])
|
if (is_master[i])
|
||||||
master.push_back(i);
|
master.push_back(i);
|
||||||
else
|
else
|
||||||
slaves.push_back(i);
|
slaves.push_back(i);
|
||||||
@ -1108,7 +1110,7 @@ int DetectorImpl::acquire() {
|
|||||||
Parallel(&Module::startAcquisition, slaves);
|
Parallel(&Module::startAcquisition, slaves);
|
||||||
Parallel(&Module::startAndReadAll, master);
|
Parallel(&Module::startAndReadAll, master);
|
||||||
} else {
|
} else {
|
||||||
//Normal acquire
|
// Normal acquire
|
||||||
Parallel(&Module::startAndReadAll, {});
|
Parallel(&Module::startAndReadAll, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1384,7 +1386,7 @@ std::vector<char> DetectorImpl::readProgrammingFile(const std::string &fname) {
|
|||||||
"Program FPGA: Could not close destination file after converting");
|
"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) << "Successfully loaded the rawbin file to program memory";
|
||||||
LOG(logDEBUG1) << "Read file into memory";
|
LOG(logDEBUG1) << "Read file into memory";
|
||||||
return buffer;
|
return buffer;
|
||||||
|
@ -149,18 +149,18 @@ SCENARIO("Parsing strings with -h or --help", "[support]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parse string with --help"){
|
TEST_CASE("Parse string with --help") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("list --help");
|
p.Parse("list --help");
|
||||||
REQUIRE(p.isHelp()==true);
|
REQUIRE(p.isHelp() == true);
|
||||||
REQUIRE(p.command()=="list");
|
REQUIRE(p.command() == "list");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parse string with -h"){
|
TEST_CASE("Parse string with -h") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("list -h");
|
p.Parse("list -h");
|
||||||
REQUIRE(p.isHelp()==true);
|
REQUIRE(p.isHelp() == true);
|
||||||
REQUIRE(p.command()=="list");
|
REQUIRE(p.command() == "list");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parsing consecutive strings resets not found det id") {
|
TEST_CASE("Parsing consecutive strings resets not found det id") {
|
||||||
@ -272,9 +272,7 @@ TEST_CASE("Double digit id", "[support]") {
|
|||||||
REQUIRE(p.arguments().empty());
|
REQUIRE(p.arguments().empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Allows space between mod id and command") {
|
||||||
|
|
||||||
TEST_CASE("Allows space between mod id and command"){
|
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("7: exptime 0.5");
|
p.Parse("7: exptime 0.5");
|
||||||
REQUIRE(p.detector_id() == 7);
|
REQUIRE(p.detector_id() == 7);
|
||||||
@ -283,7 +281,7 @@ TEST_CASE("Allows space between mod id and command"){
|
|||||||
REQUIRE(p.arguments()[0] == "0.5");
|
REQUIRE(p.arguments()[0] == "0.5");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Allows space between mod id and command also without :"){
|
TEST_CASE("Allows space between mod id and command also without :") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("1 exptime 0.5");
|
p.Parse("1 exptime 0.5");
|
||||||
REQUIRE(p.detector_id() == 1);
|
REQUIRE(p.detector_id() == 1);
|
||||||
@ -292,7 +290,7 @@ TEST_CASE("Allows space between mod id and command also without :"){
|
|||||||
REQUIRE(p.arguments()[0] == "0.5");
|
REQUIRE(p.arguments()[0] == "0.5");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Allows space between mod id and command when detector id is used"){
|
TEST_CASE("Allows space between mod id and command when detector id is used") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("1-5 exptime 0.5");
|
p.Parse("1-5 exptime 0.5");
|
||||||
REQUIRE(p.detector_id() == 5);
|
REQUIRE(p.detector_id() == 5);
|
||||||
@ -302,7 +300,7 @@ TEST_CASE("Allows space between mod id and command when detector id is used"){
|
|||||||
REQUIRE(p.arguments()[0] == "0.5");
|
REQUIRE(p.arguments()[0] == "0.5");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Allows space between mod id and command with detector id and :"){
|
TEST_CASE("Allows space between mod id and command with detector id and :") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("1-5: exptime 0.5");
|
p.Parse("1-5: exptime 0.5");
|
||||||
REQUIRE(p.detector_id() == 5);
|
REQUIRE(p.detector_id() == 5);
|
||||||
@ -312,7 +310,7 @@ TEST_CASE("Allows space between mod id and command with detector id and :"){
|
|||||||
REQUIRE(p.arguments()[0] == "0.5");
|
REQUIRE(p.arguments()[0] == "0.5");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parse receiver ID"){
|
TEST_CASE("Parse receiver ID") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("2-5:3 flowcontrol10g 1");
|
p.Parse("2-5:3 flowcontrol10g 1");
|
||||||
REQUIRE(p.detector_id() == 5);
|
REQUIRE(p.detector_id() == 5);
|
||||||
@ -320,84 +318,81 @@ TEST_CASE("Parse receiver ID"){
|
|||||||
REQUIRE(p.command() == "flowcontrol10g");
|
REQUIRE(p.command() == "flowcontrol10g");
|
||||||
REQUIRE(p.arguments().size() == 1);
|
REQUIRE(p.arguments().size() == 1);
|
||||||
REQUIRE(p.arguments()[0] == "1");
|
REQUIRE(p.arguments()[0] == "1");
|
||||||
REQUIRE(p.receiver_id()==3);
|
REQUIRE(p.receiver_id() == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parse receiver ID no det id"){
|
TEST_CASE("Parse receiver ID no det id") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("5:95 flowcontrol10g");
|
p.Parse("5:95 flowcontrol10g");
|
||||||
REQUIRE(p.detector_id() == 5);
|
REQUIRE(p.detector_id() == 5);
|
||||||
REQUIRE(p.multi_id() == 0);
|
REQUIRE(p.multi_id() == 0);
|
||||||
REQUIRE(p.command() == "flowcontrol10g");
|
REQUIRE(p.command() == "flowcontrol10g");
|
||||||
REQUIRE(p.arguments().size() == 0);
|
REQUIRE(p.arguments().size() == 0);
|
||||||
REQUIRE(p.receiver_id()==95);
|
REQUIRE(p.receiver_id() == 95);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Det id but no mod id") {
|
||||||
|
|
||||||
TEST_CASE("Det id but no mod id"){
|
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("1-exptime");
|
p.Parse("1-exptime");
|
||||||
REQUIRE(p.detector_id() == -1); //not there
|
REQUIRE(p.detector_id() == -1); // not there
|
||||||
REQUIRE(p.multi_id() == 1);
|
REQUIRE(p.multi_id() == 1);
|
||||||
REQUIRE(p.command() == "exptime");
|
REQUIRE(p.command() == "exptime");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Det id but no mod id but with space after -"){
|
TEST_CASE("Det id but no mod id but with space after -") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("1- exptime");
|
p.Parse("1- exptime");
|
||||||
REQUIRE(p.detector_id() == -1); //not there
|
REQUIRE(p.detector_id() == -1); // not there
|
||||||
REQUIRE(p.multi_id() == 1);
|
REQUIRE(p.multi_id() == 1);
|
||||||
REQUIRE(p.command() == "exptime");
|
REQUIRE(p.command() == "exptime");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parse receiver ID no det id no mod"){
|
TEST_CASE("Parse receiver ID no det id no mod") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse(":95 flowcontrol10g");
|
p.Parse(":95 flowcontrol10g");
|
||||||
REQUIRE(p.detector_id() == -1); //not there
|
REQUIRE(p.detector_id() == -1); // not there
|
||||||
REQUIRE(p.multi_id() == 0);
|
REQUIRE(p.multi_id() == 0);
|
||||||
REQUIRE(p.command() == "flowcontrol10g");
|
REQUIRE(p.command() == "flowcontrol10g");
|
||||||
REQUIRE(p.arguments().size() == 0);
|
REQUIRE(p.arguments().size() == 0);
|
||||||
REQUIRE(p.receiver_id()==95);
|
REQUIRE(p.receiver_id() == 95);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parse mod and receiver id"){
|
TEST_CASE("Parse mod and receiver id") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("1:3 exptime");
|
p.Parse("1:3 exptime");
|
||||||
REQUIRE(p.detector_id() == 1);
|
REQUIRE(p.detector_id() == 1);
|
||||||
REQUIRE(p.receiver_id()==3);
|
REQUIRE(p.receiver_id() == 3);
|
||||||
REQUIRE(p.command() == "exptime");
|
REQUIRE(p.command() == "exptime");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Det id but no no mod"){
|
TEST_CASE("Det id but no no mod") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("2-:35 exptime");
|
p.Parse("2-:35 exptime");
|
||||||
REQUIRE(p.detector_id() == -1);
|
REQUIRE(p.detector_id() == -1);
|
||||||
REQUIRE(p.receiver_id()==35);
|
REQUIRE(p.receiver_id() == 35);
|
||||||
REQUIRE(p.multi_id() == 2);
|
REQUIRE(p.multi_id() == 2);
|
||||||
REQUIRE(p.command() == "exptime");
|
REQUIRE(p.command() == "exptime");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("All stuff"){
|
TEST_CASE("All stuff") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("3-4:2 exptime");
|
p.Parse("3-4:2 exptime");
|
||||||
REQUIRE(p.detector_id() == 4);
|
REQUIRE(p.detector_id() == 4);
|
||||||
REQUIRE(p.receiver_id()==2);
|
REQUIRE(p.receiver_id() == 2);
|
||||||
REQUIRE(p.multi_id() == 3);
|
REQUIRE(p.multi_id() == 3);
|
||||||
REQUIRE(p.command() == "exptime");
|
REQUIRE(p.command() == "exptime");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parse a command that has -h in it"){
|
TEST_CASE("Parse a command that has -h in it") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("1-hostname somepc");
|
p.Parse("1-hostname somepc");
|
||||||
REQUIRE(p.multi_id() == 1);
|
REQUIRE(p.multi_id() == 1);
|
||||||
REQUIRE(p.command() == "hostname");
|
REQUIRE(p.command() == "hostname");
|
||||||
REQUIRE(p.arguments().size() == 1);
|
REQUIRE(p.arguments().size() == 1);
|
||||||
REQUIRE(p.arguments()[0]== "somepc");
|
REQUIRE(p.arguments()[0] == "somepc");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parse a command in the form 0-1 command"){
|
TEST_CASE("Parse a command in the form 0-1 command") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("3-5 exptime");
|
p.Parse("3-5 exptime");
|
||||||
REQUIRE(p.multi_id() == 3);
|
REQUIRE(p.multi_id() == 3);
|
||||||
@ -405,7 +400,7 @@ TEST_CASE("Parse a command in the form 0-1 command"){
|
|||||||
REQUIRE(p.command() == "exptime");
|
REQUIRE(p.command() == "exptime");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Parse a command in the form 0-1:command"){
|
TEST_CASE("Parse a command in the form 0-1:command") {
|
||||||
CmdParser p;
|
CmdParser p;
|
||||||
p.Parse("3-5:exptime");
|
p.Parse("3-5:exptime");
|
||||||
REQUIRE(p.multi_id() == 3);
|
REQUIRE(p.multi_id() == 3);
|
||||||
|
@ -289,7 +289,8 @@ TEST_CASE("comp_disable_time", "[.cmd]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU && det.getChipVersion().squash()*10 == 11) {
|
if (det_type == defs::JUNGFRAU &&
|
||||||
|
det.getChipVersion().squash() * 10 == 11) {
|
||||||
auto prev_val = det.getComparatorDisableTime();
|
auto prev_val = det.getComparatorDisableTime();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@ -321,7 +322,7 @@ TEST_CASE("storagecells", "[.cmd]") {
|
|||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
// chip version 1.0
|
// chip version 1.0
|
||||||
if (det.getChipVersion().squash()*10 == 10) {
|
if (det.getChipVersion().squash() * 10 == 10) {
|
||||||
auto prev_val = det.getNumberOfAdditionalStorageCells().tsquash(
|
auto prev_val = det.getNumberOfAdditionalStorageCells().tsquash(
|
||||||
"inconsistent #additional storage cells to test");
|
"inconsistent #additional storage cells to test");
|
||||||
{
|
{
|
||||||
@ -370,7 +371,7 @@ TEST_CASE("storagecell_start", "[.cmd]") {
|
|||||||
REQUIRE(oss.str() == "storagecell_start 1\n");
|
REQUIRE(oss.str() == "storagecell_start 1\n");
|
||||||
}
|
}
|
||||||
// chip version 1.0
|
// chip version 1.0
|
||||||
if (det.getChipVersion().squash()*10 == 10) {
|
if (det.getChipVersion().squash() * 10 == 10) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("storagecell_start", {"15"}, -1, PUT, oss);
|
proxy.Call("storagecell_start", {"15"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_start 15\n");
|
REQUIRE(oss.str() == "storagecell_start 15\n");
|
||||||
@ -409,7 +410,7 @@ TEST_CASE("storagecell_delay", "[.cmd]") {
|
|||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
// chip version 1.0
|
// chip version 1.0
|
||||||
if (det.getChipVersion().squash()*10 == 10) {
|
if (det.getChipVersion().squash() * 10 == 10) {
|
||||||
auto prev_val = det.getStorageCellDelay();
|
auto prev_val = det.getStorageCellDelay();
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@ -426,7 +427,8 @@ TEST_CASE("storagecell_delay", "[.cmd]") {
|
|||||||
proxy.Call("storagecell_delay", {"0"}, -1, PUT, oss);
|
proxy.Call("storagecell_delay", {"0"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "storagecell_delay 0\n");
|
REQUIRE(oss.str() == "storagecell_delay 0\n");
|
||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1638376ns"}, -1, PUT));
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call("storagecell_delay", {"1638376ns"}, -1, PUT));
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setStorageCellDelay(prev_val[i], {i});
|
det.setStorageCellDelay(prev_val[i], {i});
|
||||||
}
|
}
|
||||||
@ -434,7 +436,8 @@ TEST_CASE("storagecell_delay", "[.cmd]") {
|
|||||||
// chip version 1.1
|
// chip version 1.1
|
||||||
else {
|
else {
|
||||||
// cannot set storage cell delay
|
// cannot set storage cell delay
|
||||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT));
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call("storagecell_delay", {"1.62ms"}, -1, PUT));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("storagecell_delay", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("storagecell_delay", {}, -1, GET));
|
||||||
|
@ -347,7 +347,8 @@ TEST_CASE("thresholdnotb", "[.cmd]") {
|
|||||||
std::string senergy = std::to_string(prev_energies[0]);
|
std::string senergy = std::to_string(prev_energies[0]);
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2;
|
||||||
proxy.Call("thresholdnotb", {senergy, "standard"}, -1, PUT, oss1);
|
proxy.Call("thresholdnotb", {senergy, "standard"}, -1, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "thresholdnotb [" + senergy + ", standard]\n");
|
REQUIRE(oss1.str() ==
|
||||||
|
"thresholdnotb [" + senergy + ", standard]\n");
|
||||||
proxy.Call("threshold", {}, -1, GET, oss2);
|
proxy.Call("threshold", {}, -1, GET, oss2);
|
||||||
REQUIRE(oss2.str() == "threshold " + senergy + "\n");
|
REQUIRE(oss2.str() == "threshold " + senergy + "\n");
|
||||||
REQUIRE_THROWS(proxy.Call("thresholdnotb",
|
REQUIRE_THROWS(proxy.Call("thresholdnotb",
|
||||||
@ -895,12 +896,15 @@ TEST_CASE("readoutspeed", "[.cmd]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU || det_type == defs::GOTTHARD2) {
|
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU ||
|
||||||
|
det_type == defs::GOTTHARD2) {
|
||||||
auto prev_val = det.getReadoutSpeed();
|
auto prev_val = det.getReadoutSpeed();
|
||||||
|
|
||||||
// full speed for jungfrau only works for new boards (chipv1.1 is with new board [hw1.0 and chipv1.0 not tested here])
|
// full speed for jungfrau only works for new boards (chipv1.1 is with
|
||||||
if ((det_type == defs::JUNGFRAU && det.getChipVersion().squash() * 10 == 11) || (det_type == defs::EIGER))
|
// new board [hw1.0 and chipv1.0 not tested here])
|
||||||
{
|
if ((det_type == defs::JUNGFRAU &&
|
||||||
|
det.getChipVersion().squash() * 10 == 11) ||
|
||||||
|
(det_type == defs::EIGER)) {
|
||||||
std::ostringstream oss1, oss2, oss3, oss4;
|
std::ostringstream oss1, oss2, oss3, oss4;
|
||||||
proxy.Call("readoutspeed", {"0"}, -1, PUT, oss1);
|
proxy.Call("readoutspeed", {"0"}, -1, PUT, oss1);
|
||||||
REQUIRE(oss1.str() == "readoutspeed full_speed\n");
|
REQUIRE(oss1.str() == "readoutspeed full_speed\n");
|
||||||
@ -957,7 +961,8 @@ TEST_CASE("readoutspeed", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"full_speed"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("readoutspeed", {"full_speed"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"half_speed"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("readoutspeed", {"half_speed"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"quarter_speed"}, -1, PUT));
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call("readoutspeed", {"quarter_speed"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"0"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("readoutspeed", {"0"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"1"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("readoutspeed", {"1"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("readoutspeed", {"2"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("readoutspeed", {"2"}, -1, PUT));
|
||||||
@ -976,8 +981,8 @@ TEST_CASE("readoutspeedlist", "[.cmd]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::GOTTHARD2 || det_type == defs::JUNGFRAU || det_type == defs::EIGER)
|
if (det_type == defs::GOTTHARD2 || det_type == defs::JUNGFRAU ||
|
||||||
{
|
det_type == defs::EIGER) {
|
||||||
REQUIRE_NOTHROW(proxy.Call("readoutspeedlist", {}, -1, GET));
|
REQUIRE_NOTHROW(proxy.Call("readoutspeedlist", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("readoutspeedlist", {}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("readoutspeedlist", {}, -1, PUT));
|
||||||
} else {
|
} else {
|
||||||
@ -1802,8 +1807,8 @@ TEST_CASE("defaultdac", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (det_type == defs::JUNGFRAU) {
|
if (det_type == defs::JUNGFRAU) {
|
||||||
std::vector<defs::dacIndex> daclist = {defs::VREF_PRECH, defs::VREF_DS,
|
std::vector<defs::dacIndex> daclist = {
|
||||||
defs::VREF_COMP};
|
defs::VREF_PRECH, defs::VREF_DS, defs::VREF_COMP};
|
||||||
for (auto it : daclist) {
|
for (auto it : daclist) {
|
||||||
auto dacname = sls::ToString(it);
|
auto dacname = sls::ToString(it);
|
||||||
auto prev_val = det.getDefaultDac(it, defs::GAIN0);
|
auto prev_val = det.getDefaultDac(it, defs::GAIN0);
|
||||||
@ -1811,16 +1816,13 @@ TEST_CASE("defaultdac", "[.cmd]") {
|
|||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("defaultdac", {dacname, "1000", "gain0"}, -1,
|
proxy.Call("defaultdac", {dacname, "1000", "gain0"}, -1,
|
||||||
PUT, oss);
|
PUT, oss);
|
||||||
REQUIRE(oss.str() ==
|
REQUIRE(oss.str() == std::string("defaultdac ") + dacname +
|
||||||
std::string("defaultdac ") + dacname +
|
|
||||||
std::string(" gain0 1000\n"));
|
std::string(" gain0 1000\n"));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("defaultdac", {dacname, "gain0"}, -1, GET,
|
proxy.Call("defaultdac", {dacname, "gain0"}, -1, GET, oss);
|
||||||
oss);
|
REQUIRE(oss.str() == std::string("defaultdac ") + dacname +
|
||||||
REQUIRE(oss.str() ==
|
|
||||||
std::string("defaultdac ") + dacname +
|
|
||||||
std::string(" gain0 1000\n"));
|
std::string(" gain0 1000\n"));
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
@ -1927,7 +1929,8 @@ TEST_CASE("blockingtrigger", "[.cmd]") {
|
|||||||
proxy.Call("blockingtrigger", {}, -1, PUT, oss);
|
proxy.Call("blockingtrigger", {}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "blockingtrigger successful\n");
|
REQUIRE(oss.str() == "blockingtrigger successful\n");
|
||||||
}
|
}
|
||||||
if (det.isVirtualDetectorServer().tsquash("inconsistent virtual detectors")) {
|
if (det.isVirtualDetectorServer().tsquash(
|
||||||
|
"inconsistent virtual detectors")) {
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||||
}
|
}
|
||||||
auto currentfnum =
|
auto currentfnum =
|
||||||
@ -2286,7 +2289,6 @@ TEST_CASE("udp_numdst", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE("udp_cleardst", "[.cmd]") {
|
TEST_CASE("udp_cleardst", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
@ -5,21 +5,21 @@
|
|||||||
|
|
||||||
using sls::Pattern;
|
using sls::Pattern;
|
||||||
|
|
||||||
TEST_CASE("Pattern is default constructable and has zeroed fields"){
|
TEST_CASE("Pattern is default constructable and has zeroed fields") {
|
||||||
Pattern p;
|
Pattern p;
|
||||||
for (int i = 0; i!=MAX_PATTERN_LENGTH; ++i)
|
for (int i = 0; i != MAX_PATTERN_LENGTH; ++i)
|
||||||
REQUIRE(p.data()->word[i] == 0);
|
REQUIRE(p.data()->word[i] == 0);
|
||||||
REQUIRE(p.data()->ioctrl == 0);
|
REQUIRE(p.data()->ioctrl == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Copy construct pattern"){
|
TEST_CASE("Copy construct pattern") {
|
||||||
Pattern p;
|
Pattern p;
|
||||||
p.data()->loop[0] = 7;
|
p.data()->loop[0] = 7;
|
||||||
Pattern p1(p);
|
Pattern p1(p);
|
||||||
REQUIRE(p1.data()->loop[0] == 7);
|
REQUIRE(p1.data()->loop[0] == 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Compare patterns"){
|
TEST_CASE("Compare patterns") {
|
||||||
Pattern p;
|
Pattern p;
|
||||||
Pattern p1;
|
Pattern p1;
|
||||||
REQUIRE(p == p1);
|
REQUIRE(p == p1);
|
||||||
@ -27,7 +27,3 @@ TEST_CASE("Compare patterns"){
|
|||||||
p1.data()->word[500] = 1;
|
p1.data()->word[500] = 1;
|
||||||
REQUIRE_FALSE(p == p1);
|
REQUIRE_FALSE(p == p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ TEST_CASE("Create SharedMemory read and write", "[detector]") {
|
|||||||
|
|
||||||
SharedMemory<Data> shm(shm_id, -1);
|
SharedMemory<Data> shm(shm_id, -1);
|
||||||
shm.CreateSharedMemory();
|
shm.CreateSharedMemory();
|
||||||
CHECK(shm.GetName() ==
|
CHECK(shm.GetName() == std::string("/slsDetectorPackage_detector_") +
|
||||||
std::string("/slsDetectorPackage_detector_") + std::to_string(shm_id));
|
std::to_string(shm_id));
|
||||||
|
|
||||||
shm()->x = 3;
|
shm()->x = 3;
|
||||||
shm()->y = 5.7;
|
shm()->y = 5.7;
|
||||||
@ -92,8 +92,8 @@ TEST_CASE("Open two shared memories to the same place", "[detector]") {
|
|||||||
TEST_CASE("Move SharedMemory", "[detector]") {
|
TEST_CASE("Move SharedMemory", "[detector]") {
|
||||||
|
|
||||||
SharedMemory<Data> shm(shm_id, -1);
|
SharedMemory<Data> shm(shm_id, -1);
|
||||||
CHECK(shm.GetName() ==
|
CHECK(shm.GetName() == std::string("/slsDetectorPackage_detector_") +
|
||||||
std::string("/slsDetectorPackage_detector_") + std::to_string(shm_id));
|
std::to_string(shm_id));
|
||||||
shm.CreateSharedMemory();
|
shm.CreateSharedMemory();
|
||||||
shm()->x = 9;
|
shm()->x = 9;
|
||||||
|
|
||||||
@ -106,8 +106,8 @@ TEST_CASE("Move SharedMemory", "[detector]") {
|
|||||||
CHECK(shm() == nullptr);
|
CHECK(shm() == nullptr);
|
||||||
CHECK(shm.size() == 0);
|
CHECK(shm.size() == 0);
|
||||||
|
|
||||||
CHECK(shm2.GetName() ==
|
CHECK(shm2.GetName() == std::string("/slsDetectorPackage_detector_") +
|
||||||
std::string("/slsDetectorPackage_detector_") + std::to_string(shm_id));
|
std::to_string(shm_id));
|
||||||
shm2.RemoveSharedMemory();
|
shm2.RemoveSharedMemory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1372,7 +1372,8 @@ int ClientInterface::set_read_n_rows(Interface &socket) {
|
|||||||
if (arg >= 0) {
|
if (arg >= 0) {
|
||||||
verifyIdle(socket);
|
verifyIdle(socket);
|
||||||
if (detType != EIGER && detType != JUNGFRAU) {
|
if (detType != EIGER && detType != JUNGFRAU) {
|
||||||
throw RuntimeError("Could not set number of rows. Not implemented for this detector");
|
throw RuntimeError("Could not set number of rows. Not implemented "
|
||||||
|
"for this detector");
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1) << "Setting number of rows:" << arg;
|
LOG(logDEBUG1) << "Setting number of rows:" << arg;
|
||||||
impl()->setReadNRows(arg);
|
impl()->setReadNRows(arg);
|
||||||
@ -1699,4 +1700,3 @@ int ClientInterface::set_detector_datastream(Interface &socket) {
|
|||||||
impl()->setDetectorDataStream(port, enable);
|
impl()->setDetectorDataStream(port, enable);
|
||||||
return socket.Send(OK);
|
return socket.Send(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,6 @@ class ClientInterface : private virtual slsDetectorDefs {
|
|||||||
int set_all_threshold(sls::ServerInterface &socket);
|
int set_all_threshold(sls::ServerInterface &socket);
|
||||||
int set_detector_datastream(sls::ServerInterface &socket);
|
int set_detector_datastream(sls::ServerInterface &socket);
|
||||||
|
|
||||||
|
|
||||||
Implementation *impl() {
|
Implementation *impl() {
|
||||||
if (receiver != nullptr) {
|
if (receiver != nullptr) {
|
||||||
return receiver.get();
|
return receiver.get();
|
||||||
|
@ -28,11 +28,11 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DataProcessor(int index, detectorType detectorType, Fifo *fifo,
|
DataProcessor(int index, detectorType detectorType, Fifo *fifo,
|
||||||
bool *activated, bool *dataStreamEnable, uint32_t *streamingFrequency,
|
bool *activated, bool *dataStreamEnable,
|
||||||
uint32_t *streamingTimerInMs, uint32_t *streamingStartFnum,
|
uint32_t *streamingFrequency, uint32_t *streamingTimerInMs,
|
||||||
bool *framePadding, std::vector<int> *ctbDbitList,
|
uint32_t *streamingStartFnum, bool *framePadding,
|
||||||
int *ctbDbitOffset, int *ctbAnalogDataBytes,
|
std::vector<int> *ctbDbitList, int *ctbDbitOffset,
|
||||||
std::mutex *hdf5Lib);
|
int *ctbAnalogDataBytes, std::mutex *hdf5Lib);
|
||||||
|
|
||||||
~DataProcessor() override;
|
~DataProcessor() override;
|
||||||
|
|
||||||
@ -61,10 +61,8 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
const int numUnitsPerReadout,
|
const int numUnitsPerReadout,
|
||||||
const uint32_t udpPortNumber,
|
const uint32_t udpPortNumber,
|
||||||
const uint32_t maxFramesPerFile,
|
const uint32_t maxFramesPerFile,
|
||||||
const uint64_t numImages,
|
const uint64_t numImages, const uint32_t dynamicRange,
|
||||||
const uint32_t dynamicRange,
|
const bool detectorDataStream);
|
||||||
const bool detectorDataStream
|
|
||||||
);
|
|
||||||
#ifdef HDF5C
|
#ifdef HDF5C
|
||||||
uint32_t GetFilesInAcquisition() const;
|
uint32_t GetFilesInAcquisition() const;
|
||||||
void CreateVirtualFile(const std::string filePath,
|
void CreateVirtualFile(const std::string filePath,
|
||||||
|
@ -193,8 +193,8 @@ void DataStreamer::ProcessAnImage(char *buf) {
|
|||||||
}
|
}
|
||||||
if (!zmqSocket->SendData(
|
if (!zmqSocket->SendData(
|
||||||
buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header),
|
buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header),
|
||||||
(uint32_t)(
|
(uint32_t)(*(
|
||||||
*((uint32_t *)buf)))) { // new size possibly from callback
|
(uint32_t *)buf)))) { // new size possibly from callback
|
||||||
LOG(logERROR) << "Could not send zmq data for fnum " << fnum
|
LOG(logERROR) << "Could not send zmq data for fnum " << fnum
|
||||||
<< " and streamer " << index;
|
<< " and streamer " << index;
|
||||||
}
|
}
|
||||||
|
@ -171,10 +171,10 @@ void Implementation::setDetectorType(const detectorType d) {
|
|||||||
&actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode,
|
&actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode,
|
||||||
&activated, &detectorDataStream[i], &silentMode));
|
&activated, &detectorDataStream[i], &silentMode));
|
||||||
dataProcessor.push_back(sls::make_unique<DataProcessor>(
|
dataProcessor.push_back(sls::make_unique<DataProcessor>(
|
||||||
i, detType, fifo_ptr, &activated,
|
i, detType, fifo_ptr, &activated, &dataStreamEnable,
|
||||||
&dataStreamEnable, &streamingFrequency, &streamingTimerInMs,
|
&streamingFrequency, &streamingTimerInMs, &streamingStartFnum,
|
||||||
&streamingStartFnum, &framePadding, &ctbDbitList,
|
&framePadding, &ctbDbitList, &ctbDbitOffset,
|
||||||
&ctbDbitOffset, &ctbAnalogDataBytes, &hdf5Lib));
|
&ctbAnalogDataBytes, &hdf5Lib));
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
listener.clear();
|
listener.clear();
|
||||||
dataProcessor.clear();
|
dataProcessor.clear();
|
||||||
@ -810,8 +810,8 @@ void Implementation::SetupWriter() {
|
|||||||
dataProcessor[i]->CreateFirstFiles(
|
dataProcessor[i]->CreateFirstFiles(
|
||||||
masterAttributes.get(), filePath, fileName, fileIndex,
|
masterAttributes.get(), filePath, fileName, fileIndex,
|
||||||
overwriteEnable, silentMode, modulePos, numThreads,
|
overwriteEnable, silentMode, modulePos, numThreads,
|
||||||
udpPortNum[i], framesPerFile, numberOfTotalFrames,
|
udpPortNum[i], framesPerFile, numberOfTotalFrames, dynamicRange,
|
||||||
dynamicRange, detectorDataStream[i]);
|
detectorDataStream[i]);
|
||||||
}
|
}
|
||||||
} catch (const sls::RuntimeError &e) {
|
} catch (const sls::RuntimeError &e) {
|
||||||
shutDownUDPSockets();
|
shutDownUDPSockets();
|
||||||
@ -882,12 +882,13 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
i, detType, fifo_ptr, &status, &udpPortNum[i], ð[i],
|
i, detType, fifo_ptr, &status, &udpPortNum[i], ð[i],
|
||||||
&numberOfTotalFrames, &udpSocketBufferSize,
|
&numberOfTotalFrames, &udpSocketBufferSize,
|
||||||
&actualUDPSocketBufferSize, &framesPerFile,
|
&actualUDPSocketBufferSize, &framesPerFile,
|
||||||
&frameDiscardMode, &activated, &detectorDataStream[i], &silentMode));
|
&frameDiscardMode, &activated, &detectorDataStream[i],
|
||||||
|
&silentMode));
|
||||||
listener[i]->SetGeneralData(generalData);
|
listener[i]->SetGeneralData(generalData);
|
||||||
|
|
||||||
dataProcessor.push_back(sls::make_unique<DataProcessor>(
|
dataProcessor.push_back(sls::make_unique<DataProcessor>(
|
||||||
i, detType, fifo_ptr, &activated,
|
i, detType, fifo_ptr, &activated, &dataStreamEnable,
|
||||||
&dataStreamEnable, &streamingFrequency, &streamingTimerInMs,
|
&streamingFrequency, &streamingTimerInMs,
|
||||||
&streamingStartFnum, &framePadding, &ctbDbitList,
|
&streamingStartFnum, &framePadding, &ctbDbitList,
|
||||||
&ctbDbitOffset, &ctbAnalogDataBytes, &hdf5Lib));
|
&ctbDbitOffset, &ctbAnalogDataBytes, &hdf5Lib));
|
||||||
dataProcessor[i]->SetGeneralData(generalData);
|
dataProcessor[i]->SetGeneralData(generalData);
|
||||||
|
@ -214,8 +214,10 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
* padding is enabled (as it will receive nothing from detector) */
|
* padding is enabled (as it will receive nothing from detector) */
|
||||||
void setActivate(const bool enable);
|
void setActivate(const bool enable);
|
||||||
bool getDetectorDataStream(const portPosition port) const;
|
bool getDetectorDataStream(const portPosition port) const;
|
||||||
/** [Eiger] If datastream is disabled, receiver will create dummy data if deactivated
|
/** [Eiger] If datastream is disabled, receiver will create dummy data if
|
||||||
* padding for that port is enabled (as it will receive nothing from detector) */
|
* deactivated
|
||||||
|
* padding for that port is enabled (as it will receive nothing from
|
||||||
|
* detector) */
|
||||||
void setDetectorDataStream(const portPosition port, const bool enable);
|
void setDetectorDataStream(const portPosition port, const bool enable);
|
||||||
int getReadNRows() const;
|
int getReadNRows() const;
|
||||||
/* [Eiger][Jungfrau] */
|
/* [Eiger][Jungfrau] */
|
||||||
|
@ -24,7 +24,7 @@ const std::string Listener::TypeName = "Listener";
|
|||||||
Listener::Listener(int ind, detectorType dtype, Fifo *f,
|
Listener::Listener(int ind, detectorType dtype, Fifo *f,
|
||||||
std::atomic<runStatus> *s, uint32_t *portno, std::string *e,
|
std::atomic<runStatus> *s, uint32_t *portno, std::string *e,
|
||||||
uint64_t *nf, int *us, int *as, uint32_t *fpf,
|
uint64_t *nf, int *us, int *as, uint32_t *fpf,
|
||||||
frameDiscardPolicy *fdp, bool *act, bool* detds, bool *sm)
|
frameDiscardPolicy *fdp, bool *act, bool *detds, bool *sm)
|
||||||
: ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype), status(s),
|
: ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype), status(s),
|
||||||
udpPortNumber(portno), eth(e), numImages(nf), udpSocketBufferSize(us),
|
udpPortNumber(portno), eth(e), numImages(nf), udpSocketBufferSize(us),
|
||||||
actualUDPSocketBufferSize(as), framesPerFile(fpf), frameDiscardMode(fdp),
|
actualUDPSocketBufferSize(as), framesPerFile(fpf), frameDiscardMode(fdp),
|
||||||
@ -203,7 +203,8 @@ void Listener::ThreadExecution() {
|
|||||||
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
<< std::hex << (void *)(buffer) << std::dec << ":" << buffer;
|
||||||
|
|
||||||
// udpsocket doesnt exist
|
// udpsocket doesnt exist
|
||||||
if (*activated && *detectorDataStream && !udpSocketAlive && !carryOverFlag) {
|
if (*activated && *detectorDataStream && !udpSocketAlive &&
|
||||||
|
!carryOverFlag) {
|
||||||
// LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not
|
// LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not
|
||||||
// created or shut down earlier";
|
// created or shut down earlier";
|
||||||
(*((uint32_t *)buffer)) = 0;
|
(*((uint32_t *)buffer)) = 0;
|
||||||
@ -212,7 +213,8 @@ void Listener::ThreadExecution() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get data
|
// get data
|
||||||
if ((*status != TRANSMITTING && (!(*activated) || !(*detectorDataStream) || udpSocketAlive)) ||
|
if ((*status != TRANSMITTING &&
|
||||||
|
(!(*activated) || !(*detectorDataStream) || udpSocketAlive)) ||
|
||||||
carryOverFlag) {
|
carryOverFlag) {
|
||||||
rc = ListenToAnImage(buffer);
|
rc = ListenToAnImage(buffer);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,8 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
*/
|
*/
|
||||||
Listener(int ind, detectorType dtype, Fifo *f, std::atomic<runStatus> *s,
|
Listener(int ind, detectorType dtype, Fifo *f, std::atomic<runStatus> *s,
|
||||||
uint32_t *portno, std::string *e, uint64_t *nf, int *us, int *as,
|
uint32_t *portno, std::string *e, uint64_t *nf, int *us, int *as,
|
||||||
uint32_t *fpf, frameDiscardPolicy *fdp, bool *act, bool* detds, bool *sm);
|
uint32_t *fpf, frameDiscardPolicy *fdp, bool *act, bool *detds,
|
||||||
|
bool *sm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
@ -189,7 +190,7 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
bool *activated;
|
bool *activated;
|
||||||
|
|
||||||
/** detector data stream */
|
/** detector data stream */
|
||||||
bool* detectorDataStream;
|
bool *detectorDataStream;
|
||||||
|
|
||||||
/** Silent Mode */
|
/** Silent Mode */
|
||||||
bool *silentMode;
|
bool *silentMode;
|
||||||
|
0
slsReceiverSoftware/src/receiver_defs.h
Executable file → Normal file
0
slsReceiverSoftware/src/receiver_defs.h
Executable file → Normal file
@ -53,7 +53,7 @@ class DataSocket {
|
|||||||
int Send(const std::string &s);
|
int Send(const std::string &s);
|
||||||
|
|
||||||
// Variadic template to send all arguments
|
// Variadic template to send all arguments
|
||||||
template <class... Args> int SendAll(Args &&... args) {
|
template <class... Args> int SendAll(Args &&...args) {
|
||||||
auto l = std::initializer_list<int>{Send(args)...};
|
auto l = std::initializer_list<int>{Send(args)...};
|
||||||
auto sum = std::accumulate(begin(l), end(l), 0);
|
auto sum = std::accumulate(begin(l), end(l), 0);
|
||||||
return sum;
|
return sum;
|
||||||
@ -86,7 +86,7 @@ class DataSocket {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int sockfd_ = -1;
|
int sockfd_ = -1;
|
||||||
int fnum_ {0};
|
int fnum_{0};
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace sls
|
}; // namespace sls
|
||||||
|
@ -19,7 +19,7 @@ namespace sls {
|
|||||||
// already available as std::make_unique in C++14
|
// already available as std::make_unique in C++14
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
|
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
|
||||||
make_unique(Args &&... args) {
|
make_unique(Args &&...args) {
|
||||||
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,31 +14,29 @@
|
|||||||
* Snippets copied from md5_local.h or md32_common.h has been marked
|
* Snippets copied from md5_local.h or md32_common.h has been marked
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef HEADER_MD5_H
|
#ifndef HEADER_MD5_H
|
||||||
# define HEADER_MD5_H
|
#define HEADER_MD5_H
|
||||||
|
|
||||||
# include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
# ifdef __cplusplus
|
|
||||||
/*
|
/*
|
||||||
* Modifications 2021 Paul Scherrer Institut
|
* Modifications 2021 Paul Scherrer Institut
|
||||||
* namespace sls added
|
* namespace sls added
|
||||||
*/
|
*/
|
||||||
namespace sls {
|
namespace sls {
|
||||||
extern "C" {
|
extern "C" {
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
* ! MD5_LONG has to be at least 32 bits wide. !
|
* ! MD5_LONG has to be at least 32 bits wide. !
|
||||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
*/
|
*/
|
||||||
# define MD5_LONG unsigned int
|
#define MD5_LONG unsigned int
|
||||||
# define MD5_CBLOCK 64
|
#define MD5_CBLOCK 64
|
||||||
# define MD5_LBLOCK (MD5_CBLOCK/4)
|
#define MD5_LBLOCK (MD5_CBLOCK / 4)
|
||||||
# define MD5_DIGEST_LENGTH 16
|
#define MD5_DIGEST_LENGTH 16
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modification 2021 Paul Scherrer Institut
|
* Modification 2021 Paul Scherrer Institut
|
||||||
@ -99,7 +97,7 @@ extern "C" {
|
|||||||
* #define HASH_FINAL MD5_Final_SLS
|
* #define HASH_FINAL MD5_Final_SLS
|
||||||
* #define HASH_BLOCK_DATA_ORDER md5_block_data_order
|
* #define HASH_BLOCK_DATA_ORDER md5_block_data_order
|
||||||
*/
|
*/
|
||||||
# define MD32_REG_T int
|
#define MD32_REG_T int
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modification 2021 Paul Scherrer Institut
|
* Modification 2021 Paul Scherrer Institut
|
||||||
@ -120,44 +118,47 @@ extern "C" {
|
|||||||
#define HASH_TRANSFORM MD5_Transform
|
#define HASH_TRANSFORM MD5_Transform
|
||||||
#define HASH_FINAL MD5_Final_SLS
|
#define HASH_FINAL MD5_Final_SLS
|
||||||
#define HASH_BLOCK_DATA_ORDER md5_block_data_order
|
#define HASH_BLOCK_DATA_ORDER md5_block_data_order
|
||||||
#define HASH_MAKE_STRING(c,s) do { \
|
#define HASH_MAKE_STRING(c, s) \
|
||||||
|
do { \
|
||||||
unsigned long ll; \
|
unsigned long ll; \
|
||||||
ll=(c)->A; (void)HOST_l2c(ll,(s)); \
|
ll = (c)->A; \
|
||||||
ll=(c)->B; (void)HOST_l2c(ll,(s)); \
|
(void)HOST_l2c(ll, (s)); \
|
||||||
ll=(c)->C; (void)HOST_l2c(ll,(s)); \
|
ll = (c)->B; \
|
||||||
ll=(c)->D; (void)HOST_l2c(ll,(s)); \
|
(void)HOST_l2c(ll, (s)); \
|
||||||
|
ll = (c)->C; \
|
||||||
|
(void)HOST_l2c(ll, (s)); \
|
||||||
|
ll = (c)->D; \
|
||||||
|
(void)HOST_l2c(ll, (s)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n))))
|
#define ROTATE(a, n) (((a) << (n)) | (((a)&0xffffffff) >> (32 - (n))))
|
||||||
#if defined(DATA_ORDER_IS_BIG_ENDIAN)
|
#if defined(DATA_ORDER_IS_BIG_ENDIAN)
|
||||||
|
|
||||||
# define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++)))<<24), \
|
#define HOST_c2l(c, l) \
|
||||||
l|=(((unsigned long)(*((c)++)))<<16), \
|
(l = (((unsigned long)(*((c)++))) << 24), \
|
||||||
l|=(((unsigned long)(*((c)++)))<< 8), \
|
l |= (((unsigned long)(*((c)++))) << 16), \
|
||||||
l|=(((unsigned long)(*((c)++))) ) )
|
l |= (((unsigned long)(*((c)++))) << 8), \
|
||||||
# define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \
|
l |= (((unsigned long)(*((c)++)))))
|
||||||
*((c)++)=(unsigned char)(((l)>>16)&0xff), \
|
#define HOST_l2c(l, c) \
|
||||||
*((c)++)=(unsigned char)(((l)>> 8)&0xff), \
|
(*((c)++) = (unsigned char)(((l) >> 24) & 0xff), \
|
||||||
*((c)++)=(unsigned char)(((l) )&0xff), \
|
*((c)++) = (unsigned char)(((l) >> 16) & 0xff), \
|
||||||
l)
|
*((c)++) = (unsigned char)(((l) >> 8) & 0xff), \
|
||||||
|
*((c)++) = (unsigned char)(((l)) & 0xff), l)
|
||||||
|
|
||||||
#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
|
#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
|
||||||
|
|
||||||
# define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \
|
#define HOST_c2l(c, l) \
|
||||||
l|=(((unsigned long)(*((c)++)))<< 8), \
|
(l = (((unsigned long)(*((c)++)))), \
|
||||||
l|=(((unsigned long)(*((c)++)))<<16), \
|
l |= (((unsigned long)(*((c)++))) << 8), \
|
||||||
l|=(((unsigned long)(*((c)++)))<<24) )
|
l |= (((unsigned long)(*((c)++))) << 16), \
|
||||||
# define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
|
l |= (((unsigned long)(*((c)++))) << 24))
|
||||||
*((c)++)=(unsigned char)(((l)>> 8)&0xff), \
|
#define HOST_l2c(l, c) \
|
||||||
*((c)++)=(unsigned char)(((l)>>16)&0xff), \
|
(*((c)++) = (unsigned char)(((l)) & 0xff), \
|
||||||
*((c)++)=(unsigned char)(((l)>>24)&0xff), \
|
*((c)++) = (unsigned char)(((l) >> 8) & 0xff), \
|
||||||
l)
|
*((c)++) = (unsigned char)(((l) >> 16) & 0xff), \
|
||||||
|
*((c)++) = (unsigned char)(((l) >> 24) & 0xff), l)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct MD5state_st {
|
typedef struct MD5state_st {
|
||||||
MD5_LONG A, B, C, D;
|
MD5_LONG A, B, C, D;
|
||||||
MD5_LONG Nl, Nh;
|
MD5_LONG Nl, Nh;
|
||||||
@ -174,10 +175,9 @@ int MD5_Final_SLS(unsigned char *md, MD5_CTX *c);
|
|||||||
* from md32_common.h
|
* from md32_common.h
|
||||||
*/
|
*/
|
||||||
void md5_block_data_order(MD5_CTX *c, const void *p, size_t num);
|
void md5_block_data_order(MD5_CTX *c, const void *p, size_t num);
|
||||||
# ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
# endif
|
#endif
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ struct UdpDestination {
|
|||||||
|
|
||||||
constexpr bool operator==(const UdpDestination &other) const {
|
constexpr bool operator==(const UdpDestination &other) const {
|
||||||
return ((entry == other.entry) && (port == other.port) &&
|
return ((entry == other.entry) && (port == other.port) &&
|
||||||
(port2 == other.port2) && (ip== other.ip) &&
|
(port2 == other.port2) && (ip == other.ip) &&
|
||||||
(ip2 == other.ip2) && (mac == other.mac) &&
|
(ip2 == other.ip2) && (mac == other.mac) &&
|
||||||
(mac2 == other.mac2));
|
(mac2 == other.mac2));
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,13 @@ typedef struct {
|
|||||||
enum readoutMode { ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL };
|
enum readoutMode { ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL };
|
||||||
|
|
||||||
/** chip speed */
|
/** chip speed */
|
||||||
enum speedLevel { FULL_SPEED, HALF_SPEED, QUARTER_SPEED, G2_108MHZ, G2_144MHZ };
|
enum speedLevel {
|
||||||
|
FULL_SPEED,
|
||||||
|
HALF_SPEED,
|
||||||
|
QUARTER_SPEED,
|
||||||
|
G2_108MHZ,
|
||||||
|
G2_144MHZ
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* burst mode for gotthard2
|
* burst mode for gotthard2
|
||||||
@ -412,7 +418,7 @@ typedef struct {
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
enum class streamingInterface {
|
enum class streamingInterface {
|
||||||
#else
|
#else
|
||||||
enum streamingInterface {
|
enum streamingInterface {
|
||||||
#endif
|
#endif
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
LOW_LATENCY_LINK = 1 << 0,
|
LOW_LATENCY_LINK = 1 << 0,
|
||||||
@ -470,8 +476,7 @@ typedef struct {
|
|||||||
uint64_t select;
|
uint64_t select;
|
||||||
|
|
||||||
/** [Gotthard2][Jungfrau] disable */
|
/** [Gotthard2][Jungfrau] disable */
|
||||||
currentSrcParameters()
|
currentSrcParameters() : enable(0), fix(-1), normal(-1), select(0) {}
|
||||||
: enable(0), fix(-1), normal(-1), select(0) {}
|
|
||||||
|
|
||||||
/** [Gotthard2] enable or disable */
|
/** [Gotthard2] enable or disable */
|
||||||
explicit currentSrcParameters(bool srcEnable)
|
explicit currentSrcParameters(bool srcEnable)
|
||||||
@ -487,7 +492,8 @@ typedef struct {
|
|||||||
/** [Jungfrau](chipv1.1) enable current src, fix[fix|no fix],
|
/** [Jungfrau](chipv1.1) enable current src, fix[fix|no fix],
|
||||||
* select is a mask of 63 bits (muliple columns can be selected
|
* select is a mask of 63 bits (muliple columns can be selected
|
||||||
* simultaneously, normal [normal|low] */
|
* simultaneously, normal [normal|low] */
|
||||||
currentSrcParameters(bool fixCurrent, uint64_t selectCurrent, bool normalCurrent)
|
currentSrcParameters(bool fixCurrent, uint64_t selectCurrent,
|
||||||
|
bool normalCurrent)
|
||||||
: enable(1), fix(static_cast<int>(fixCurrent)),
|
: enable(1), fix(static_cast<int>(fixCurrent)),
|
||||||
normal(static_cast<int>(normalCurrent)), select(selectCurrent) {}
|
normal(static_cast<int>(normalCurrent)), select(selectCurrent) {}
|
||||||
|
|
||||||
@ -647,7 +653,7 @@ struct detParameters {
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
struct sls_detector_module {
|
struct sls_detector_module {
|
||||||
#else
|
#else
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#endif
|
#endif
|
||||||
int serialnumber; /**< is the module serial number */
|
int serialnumber; /**< is the module serial number */
|
||||||
int nchan; /**< is the number of channels on the module*/
|
int nchan; /**< is the number of channels on the module*/
|
||||||
@ -718,4 +724,3 @@ using Positions = const std::vector<int> &;
|
|||||||
using defs = slsDetectorDefs;
|
using defs = slsDetectorDefs;
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ std::string RemoveUnit(std::string &str);
|
|||||||
|
|
||||||
bool is_int(const std::string &s);
|
bool is_int(const std::string &s);
|
||||||
|
|
||||||
bool replace_first(std::string *s, const std::string& substr, const std::string& repl);
|
bool replace_first(std::string *s, const std::string &substr,
|
||||||
|
const std::string &repl);
|
||||||
|
|
||||||
} // namespace sls
|
} // namespace sls
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
#include "sls/DataSocket.h"
|
#include "sls/DataSocket.h"
|
||||||
#include "sls/logger.h"
|
#include "sls/logger.h"
|
||||||
#include "sls/sls_detector_funcs.h"
|
|
||||||
#include "sls/sls_detector_exceptions.h"
|
#include "sls/sls_detector_exceptions.h"
|
||||||
|
#include "sls/sls_detector_funcs.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -44,9 +44,7 @@ DataSocket &DataSocket::operator=(DataSocket &&move) noexcept {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataSocket::setFnum(const int fnum) {
|
void DataSocket::setFnum(const int fnum) { fnum_ = fnum; }
|
||||||
fnum_ = fnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
int DataSocket::Receive(void *buffer, size_t size) {
|
int DataSocket::Receive(void *buffer, size_t size) {
|
||||||
// TODO!(Erik) Add sleep? how many reties?
|
// TODO!(Erik) Add sleep? how many reties?
|
||||||
@ -65,7 +63,8 @@ int DataSocket::Receive(void *buffer, size_t size) {
|
|||||||
} else {
|
} else {
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "TCP socket read " << bytes_read << " bytes instead of "
|
ss << "TCP socket read " << bytes_read << " bytes instead of "
|
||||||
<< bytes_expected << " bytes (" << getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
|
<< bytes_expected << " bytes ("
|
||||||
|
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
|
||||||
throw sls::SocketError(ss.str());
|
throw sls::SocketError(ss.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,7 +89,8 @@ int DataSocket::Send(const void *buffer, size_t size) {
|
|||||||
if (bytes_sent != data_size) {
|
if (bytes_sent != data_size) {
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "TCP socket sent " << bytes_sent << " bytes instead of "
|
ss << "TCP socket sent " << bytes_sent << " bytes instead of "
|
||||||
<< data_size << " bytes (" << getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
|
<< data_size << " bytes ("
|
||||||
|
<< getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
|
||||||
throw sls::SocketError(ss.str());
|
throw sls::SocketError(ss.str());
|
||||||
}
|
}
|
||||||
return bytes_sent;
|
return bytes_sent;
|
||||||
|
6
slsSupportLib/src/string_utils.cpp
Executable file → Normal file
6
slsSupportLib/src/string_utils.cpp
Executable file → Normal file
@ -38,14 +38,14 @@ bool is_int(const std::string &s) {
|
|||||||
}) == s.end();
|
}) == s.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool replace_first(std::string *s, const std::string& substr, const std::string& repl){
|
bool replace_first(std::string *s, const std::string &substr,
|
||||||
|
const std::string &repl) {
|
||||||
auto pos = s->find(substr);
|
auto pos = s->find(substr);
|
||||||
if (pos != std::string::npos){
|
if (pos != std::string::npos) {
|
||||||
s->replace(pos, substr.size(), repl);
|
s->replace(pos, substr.size(), repl);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}; // namespace sls
|
}; // namespace sls
|
@ -4,7 +4,6 @@
|
|||||||
#include "sls/ClientSocket.h"
|
#include "sls/ClientSocket.h"
|
||||||
#include "sls/ServerSocket.h"
|
#include "sls/ServerSocket.h"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
|
||||||
#include <future>
|
#include <future>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
@ -331,12 +331,12 @@ TEST_CASE("streamingInterface") {
|
|||||||
REQUIRE(ToString(sls::defs::streamingInterface::ETHERNET_10GB) == "10gbe");
|
REQUIRE(ToString(sls::defs::streamingInterface::ETHERNET_10GB) == "10gbe");
|
||||||
REQUIRE(ToString(sls::defs::streamingInterface::LOW_LATENCY_LINK) == "lll");
|
REQUIRE(ToString(sls::defs::streamingInterface::LOW_LATENCY_LINK) == "lll");
|
||||||
REQUIRE(ToString(sls::defs::streamingInterface::LOW_LATENCY_LINK |
|
REQUIRE(ToString(sls::defs::streamingInterface::LOW_LATENCY_LINK |
|
||||||
sls::defs::streamingInterface::ETHERNET_10GB) == "lll, 10gbe");
|
sls::defs::streamingInterface::ETHERNET_10GB) ==
|
||||||
|
"lll, 10gbe");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Speed level
|
||||||
//Speed level
|
TEST_CASE("speedLevel to string") {
|
||||||
TEST_CASE("speedLevel to string"){
|
|
||||||
REQUIRE(ToString(sls::defs::speedLevel::FULL_SPEED) == "full_speed");
|
REQUIRE(ToString(sls::defs::speedLevel::FULL_SPEED) == "full_speed");
|
||||||
REQUIRE(ToString(sls::defs::speedLevel::HALF_SPEED) == "half_speed");
|
REQUIRE(ToString(sls::defs::speedLevel::HALF_SPEED) == "half_speed");
|
||||||
REQUIRE(ToString(sls::defs::speedLevel::QUARTER_SPEED) == "quarter_speed");
|
REQUIRE(ToString(sls::defs::speedLevel::QUARTER_SPEED) == "quarter_speed");
|
||||||
@ -344,10 +344,15 @@ TEST_CASE("speedLevel to string"){
|
|||||||
REQUIRE(ToString(sls::defs::speedLevel::G2_144MHZ) == "144");
|
REQUIRE(ToString(sls::defs::speedLevel::G2_144MHZ) == "144");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("string to speedLevel"){
|
TEST_CASE("string to speedLevel") {
|
||||||
REQUIRE(StringTo<sls::defs::speedLevel>("full_speed") == sls::defs::speedLevel::FULL_SPEED);
|
REQUIRE(StringTo<sls::defs::speedLevel>("full_speed") ==
|
||||||
REQUIRE(StringTo<sls::defs::speedLevel>("half_speed") == sls::defs::speedLevel::HALF_SPEED);
|
sls::defs::speedLevel::FULL_SPEED);
|
||||||
REQUIRE(StringTo<sls::defs::speedLevel>("quarter_speed") == sls::defs::speedLevel::QUARTER_SPEED);
|
REQUIRE(StringTo<sls::defs::speedLevel>("half_speed") ==
|
||||||
REQUIRE(StringTo<sls::defs::speedLevel>("108") == sls::defs::speedLevel::G2_108MHZ);
|
sls::defs::speedLevel::HALF_SPEED);
|
||||||
REQUIRE(StringTo<sls::defs::speedLevel>("144") == sls::defs::speedLevel::G2_144MHZ);
|
REQUIRE(StringTo<sls::defs::speedLevel>("quarter_speed") ==
|
||||||
|
sls::defs::speedLevel::QUARTER_SPEED);
|
||||||
|
REQUIRE(StringTo<sls::defs::speedLevel>("108") ==
|
||||||
|
sls::defs::speedLevel::G2_108MHZ);
|
||||||
|
REQUIRE(StringTo<sls::defs::speedLevel>("144") ==
|
||||||
|
sls::defs::speedLevel::G2_144MHZ);
|
||||||
}
|
}
|
@ -114,8 +114,7 @@ TEST_CASE("Copy construct a MacAddr") {
|
|||||||
CHECK(addr == addr2);
|
CHECK(addr == addr2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("udp dst struct basic properties") {
|
||||||
TEST_CASE("udp dst struct basic properties"){
|
|
||||||
static_assert(sizeof(UdpDestination) == 36);
|
static_assert(sizeof(UdpDestination) == 36);
|
||||||
UdpDestination dst{};
|
UdpDestination dst{};
|
||||||
REQUIRE(dst.entry == 0);
|
REQUIRE(dst.entry == 0);
|
||||||
@ -125,8 +124,6 @@ TEST_CASE("udp dst struct basic properties"){
|
|||||||
REQUIRE(dst.ip2 == 0);
|
REQUIRE(dst.ip2 == 0);
|
||||||
REQUIRE(dst.mac == 0);
|
REQUIRE(dst.mac == 0);
|
||||||
REQUIRE(dst.mac2 == 0);
|
REQUIRE(dst.mac2 == 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// TODO!(Erik) Look up a real hostname and verify the IP
|
// TODO!(Erik) Look up a real hostname and verify the IP
|
||||||
|
@ -78,29 +78,28 @@ TEST_CASE("Check is string is integer") {
|
|||||||
REQUIRE_FALSE(sls::is_int(""));
|
REQUIRE_FALSE(sls::is_int(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Replace substring in string") {
|
||||||
TEST_CASE("Replace substring in string"){
|
|
||||||
std::string s = "this string should be replaced";
|
std::string s = "this string should be replaced";
|
||||||
auto r = sls::replace_first(&s, "string ", "");
|
auto r = sls::replace_first(&s, "string ", "");
|
||||||
REQUIRE(r == true);
|
REQUIRE(r == true);
|
||||||
REQUIRE(s == "this should be replaced");
|
REQUIRE(s == "this should be replaced");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Replace --help in command"){
|
TEST_CASE("Replace --help in command") {
|
||||||
std::string s = "sls_detector_get --help exptime";
|
std::string s = "sls_detector_get --help exptime";
|
||||||
auto r = sls::replace_first(&s, " --help", "");
|
auto r = sls::replace_first(&s, " --help", "");
|
||||||
REQUIRE(r == true);
|
REQUIRE(r == true);
|
||||||
REQUIRE(s == "sls_detector_get exptime");
|
REQUIRE(s == "sls_detector_get exptime");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Replace -h in command"){
|
TEST_CASE("Replace -h in command") {
|
||||||
std::string s = "sls_detector_get -h exptime";
|
std::string s = "sls_detector_get -h exptime";
|
||||||
auto r = sls::replace_first(&s, " -h", "");
|
auto r = sls::replace_first(&s, " -h", "");
|
||||||
REQUIRE(r == true);
|
REQUIRE(r == true);
|
||||||
REQUIRE(s == "sls_detector_get exptime");
|
REQUIRE(s == "sls_detector_get exptime");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("replace --help"){
|
TEST_CASE("replace --help") {
|
||||||
std::string s = "list --help";
|
std::string s = "list --help";
|
||||||
auto r = sls::replace_first(&s, " --help", "");
|
auto r = sls::replace_first(&s, " --help", "");
|
||||||
REQUIRE(r == true);
|
REQUIRE(r == true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user