Compare commits

..

1 Commits

Author SHA1 Message Date
641b40ffe0 fixed zmq path when building as submodule 2024-01-12 09:18:12 +01:00
77 changed files with 2376 additions and 5013 deletions

View File

@ -232,8 +232,6 @@ if (NOT TARGET slsProjectCSettings)
-Wredundant-decls -Wredundant-decls
-Wdouble-promotion -Wdouble-promotion
-Werror=return-type -Werror=return-type
-Wno-format-overflow
-Wno-format-truncation
) )
sls_disable_c_warning("-Wstringop-truncation") sls_disable_c_warning("-Wstringop-truncation")
endif() endif()

View File

@ -1,22 +0,0 @@
numfiles 1
nthreads 5,
fifosize 5000
nsigma 5
gainfile none
detectorMode counting
threshold 0
pedestalfile none
nframes 0
xMin 0
xMax 400
yMin 0
yMax 400
outdir ./
indir ./
flist none
fformat none
runmin 0
runmax -1
readnrows 400
eMin 0
eMax 16000

View File

@ -1,16 +0,0 @@
numinterfaces 1
rx_zmqip 10.1.2.102
rx_zmqport 1978
zmqip 129.129.202.57
zmqport 1979
nthreads 6
fifosize 5000
nsigma 5
gainfile none
nbinsx 5
nbinsy 5
etafile none
etabinsx 1000
etabinsy 1000
etamin -1
etamax 2

View File

@ -3,10 +3,3 @@ slsDetectorPackage/7.0.1_rh7 stable cmake/3.15.5 zeromq/4.3.4 Qt/5.12.10
slsDetectorPackage/7.0.1_rh8 stable cmake/3.15.5 zeromq/4.3.4 Qt/5.12.10 slsDetectorPackage/7.0.1_rh8 stable cmake/3.15.5 zeromq/4.3.4 Qt/5.12.10
slsDetectorPackage/7.0.2_rh7 stable cmake/3.15.5 zeromq/4.3.4 Qt/5.12.10 slsDetectorPackage/7.0.2_rh7 stable cmake/3.15.5 zeromq/4.3.4 Qt/5.12.10
slsDetectorPackage/7.0.2_rh8 stable cmake/3.15.5 zeromq/4.3.4 Qt/5.12.10 slsDetectorPackage/7.0.2_rh8 stable cmake/3.15.5 zeromq/4.3.4 Qt/5.12.10
slsDetectorPackage/7.0.3_rh7 stable cmake/3.15.5 zeromq/4.3.4 Qt/5.12.10
slsDetectorPackage/7.0.3_rh8 stable cmake/3.15.5 zeromq/4.3.4 Qt/5.12.10
slsDetectorPackage/8.0.0_rh7 stable cmake/3.15.5 Qt/5.12.10
slsDetectorPackage/8.0.0_rh8 stable cmake/3.15.5 Qt/5.12.10
slsDetectorPackage/8.0.1_rh7 stable cmake/3.15.5 Qt/5.12.10
slsDetectorPackage/8.0.1_rh8 stable cmake/3.15.5 Qt/5.12.10

View File

@ -414,7 +414,7 @@ class Detector(CppDetectorApi):
@element @element
def framecounter(self): def framecounter(self):
""" """
[Jungfrau][Moench][Mythen3][Gotthard2][CTB][Xilinx Ctb] Number of frames from start run control. [Jungfrau][Moench][Mythen3][Gotthard2][CTB] Number of frames from start run control.
Note Note
----- -----
@ -443,13 +443,12 @@ class Detector(CppDetectorApi):
@element @element
def powerchip(self): def powerchip(self):
""" """
[Jungfrau][Moench][Mythen3][Gotthard2][Xilinx Ctb] Power the chip. [Jungfrau][Moench][Mythen3][Gotthard2] Power the chip.
Note Note
---- ----
[Jungfrau][Moench] Default is disabled. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1).\n [Jungfrau][Moench] Default is disabled. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1).\n
[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail. [Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail.
[Xilinx Ctb] Default is 0. Also configures the chip if powered on.
""" """
return self.getPowerChip() return self.getPowerChip()
@ -457,16 +456,6 @@ class Detector(CppDetectorApi):
def powerchip(self, value): def powerchip(self, value):
ut.set_using_dict(self.setPowerChip, value) ut.set_using_dict(self.setPowerChip, value)
def configtransceiver(self):
"""
[Xilinx Ctb] Waits for transceiver to be aligned.
Note
----
Chip had to be configured (powered on) before this.
"""
self.configureTransceiver()
@property @property
@element @element
def triggers(self): def triggers(self):
@ -631,7 +620,7 @@ class Detector(CppDetectorApi):
@element @element
def periodl(self): def periodl(self):
""" """
[Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2][Xilinx Ctb] Period left for current frame. [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2] Period left for current frame.
Note Note
----- -----
@ -653,7 +642,7 @@ class Detector(CppDetectorApi):
@element @element
def delay(self): def delay(self):
""" """
[Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2][Xilinx Ctb] Delay after trigger, accepts either a value in seconds, DurationWrapper or datetime.timedelta [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2] Delay after trigger, accepts either a value in seconds, DurationWrapper or datetime.timedelta
:getter: always returns in seconds. To get in DurationWrapper, use getDelayAfterTrigger :getter: always returns in seconds. To get in DurationWrapper, use getDelayAfterTrigger
@ -695,7 +684,7 @@ class Detector(CppDetectorApi):
@element @element
def delayl(self): def delayl(self):
""" """
[Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2][Xilinx Ctb] Delay left after trigger during acquisition, accepts either a value in seconds, datetime.timedelta or DurationWrapper [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2] Delay left after trigger during acquisition, accepts either a value in seconds, datetime.timedelta or DurationWrapper
Note Note
----- -----
@ -743,7 +732,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def nextframenumber(self): def nextframenumber(self):
"""[Eiger][Jungfrau][Moench][CTB][Xilinx CTB] Next frame number. Stopping acquisition might result in different frame numbers for different modules. """ """[Eiger][Jungfrau][Moench][CTB] Next frame number. Stopping acquisition might result in different frame numbers for different modules. """
return self.getNextFrameNumber() return self.getNextFrameNumber()
@nextframenumber.setter @nextframenumber.setter
@ -1975,7 +1964,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def frametime(self): def frametime(self):
"""[Jungfrau][Moench][Mythen3][Gotthard2][CTB][Xilinx Ctb] Timestamp at a frame start. """[Jungfrau][Moench][Mythen3][Gotthard2][CTB] Timestamp at a frame start.
Note Note
---- ----
@ -2613,7 +2602,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def runtime(self): def runtime(self):
"""[Jungfrau][Moench][Mythen3][Gotthard2][CTB][Xilinx Ctb] Time from detector start up. """[Jungfrau][Moench][Mythen3][Gotthard2][CTB] Time from detector start up.
Note Note
----- -----
@ -3248,7 +3237,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def transceiverenable(self): def transceiverenable(self):
"""[CTB][Xilinx CTB] Transceiver Enable Mask. Enable for each 4 transceiver channel.""" """[Ctb] Transceiver Enable Mask. Enable for each 4 transceiver channel."""
return self.getTransceiverEnableMask() return self.getTransceiverEnableMask()
@transceiverenable.setter @transceiverenable.setter
@ -3287,10 +3276,8 @@ class Detector(CppDetectorApi):
Note Note
------ ------
[CTB] Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL, TRANSCEIVER_ONLY, DIGITAL_AND_TRANSCEIVER Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL, TRANSCEIVER_ONLY, DIGITAL_AND_TRANSCEIVER
[CTB] Default: ANALOG_ONLY Default: ANALOG_ONLY
[Xilinx CTB] Options: TRANSCEIVER_ONLY
[Xilinx CTB] Default: TRANSCEIVER_ONLY
Example Example
-------- --------
@ -3327,7 +3314,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def tsamples(self): def tsamples(self):
"""[CTB][Xilinx CTB] Number of transceiver samples expected. """ """[CTB] Number of transceiver samples expected. """
return self.getNumberOfTransceiverSamples() return self.getNumberOfTransceiverSamples()
@tsamples.setter @tsamples.setter
@ -3846,7 +3833,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_a(self): def v_a(self):
"""[Ctb][Xilinx Ctb] Power supply a in mV.""" """[Ctb] Power supply a in mV."""
return self.getPower(dacIndex.V_POWER_A) return self.getPower(dacIndex.V_POWER_A)
@v_a.setter @v_a.setter
@ -3857,7 +3844,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_b(self): def v_b(self):
"""[Ctb][Xilinx Ctb] Power supply b in mV.""" """[Ctb] Power supply b in mV."""
return self.getPower(dacIndex.V_POWER_B) return self.getPower(dacIndex.V_POWER_B)
@v_b.setter @v_b.setter
@ -3868,7 +3855,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_c(self): def v_c(self):
"""[Ctb][Xilinx Ctb] Power supply c in mV.""" """[Ctb] Power supply c in mV."""
return self.getPower(dacIndex.V_POWER_C) return self.getPower(dacIndex.V_POWER_C)
@v_c.setter @v_c.setter
@ -3879,7 +3866,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_d(self): def v_d(self):
"""[Ctb][Xilinx Ctb] Power supply d in mV.""" """[Ctb] Power supply d in mV."""
return self.getPower(dacIndex.V_POWER_D) return self.getPower(dacIndex.V_POWER_D)
@v_d.setter @v_d.setter
@ -3890,7 +3877,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_io(self): def v_io(self):
"""[Ctb][Xilinx Ctb] Power supply io in mV. Minimum 1200 mV. """[Ctb] Power supply io in mV. Minimum 1200 mV.
Note Note
---- ----
@ -3906,7 +3893,7 @@ class Detector(CppDetectorApi):
@property @property
@element @element
def v_limit(self): def v_limit(self):
"""[Ctb][Xilinx Ctb] Soft limit for power supplies (ctb only) and DACS in mV.""" """[Ctb] Soft limit for power supplies (ctb only) and DACS in mV."""
return self.getPower(dacIndex.V_LIMIT) return self.getPower(dacIndex.V_LIMIT)
@v_limit.setter @v_limit.setter

View File

@ -1778,10 +1778,6 @@ void init_det(py::module &m) {
(std::string(Detector::*)(const defs::dacIndex) const) & (std::string(Detector::*)(const defs::dacIndex) const) &
Detector::getSlowADCName, Detector::getSlowADCName,
py::arg()); py::arg());
CppDetectorApi.def("configureTransceiver",
(void (Detector::*)(sls::Positions)) &
Detector::configureTransceiver,
py::arg() = Positions{});
CppDetectorApi.def( CppDetectorApi.def(
"getPatterFileName", "getPatterFileName",
(Result<std::string>(Detector::*)(sls::Positions) const) & (Result<std::string>(Detector::*)(sls::Positions) const) &

View File

@ -25,8 +25,6 @@ void init_enums(py::module &m) {
.value("MOENCH", slsDetectorDefs::detectorType::MOENCH) .value("MOENCH", slsDetectorDefs::detectorType::MOENCH)
.value("MYTHEN3", slsDetectorDefs::detectorType::MYTHEN3) .value("MYTHEN3", slsDetectorDefs::detectorType::MYTHEN3)
.value("GOTTHARD2", slsDetectorDefs::detectorType::GOTTHARD2) .value("GOTTHARD2", slsDetectorDefs::detectorType::GOTTHARD2)
.value("XILINX_CHIPTESTBOARD",
slsDetectorDefs::detectorType::XILINX_CHIPTESTBOARD)
.export_values(); .export_values();
py::enum_<slsDetectorDefs::runStatus>(Defs, "runStatus") py::enum_<slsDetectorDefs::runStatus>(Defs, "runStatus")

View File

@ -1,240 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef MOENCH03v2DATA_H
#define MOENCH03v2DATA_H
//#define MYROOT
#ifndef MYROOT
#include "sls/sls_detector_defs.h"
#endif
#ifdef MYROOT
typedef struct {
uint64_t frameNumber;
uint32_t expLength;
uint32_t packetNumber;
uint64_t bunchId;
uint64_t timestamp;
uint16_t modId;
uint16_t row;
uint16_t column;
uint16_t reserved;
uint32_t debug;
uint16_t roundRNumber;
uint8_t detType;
uint8_t version;
} sls_detector_header;
#define MAX_NUM_PACKETS 512
// using sls_bitset = std::bitset<MAX_NUM_PACKETS>;
// using bitset_storage = uint8_t[MAX_NUM_PACKETS / 8];
struct sls_receiver_header {
sls_detector_header detHeader; /**< is the detector header */
uint8_t packetsMask[64]; /**< is the packets caught bit mask */
};
#endif
#include "slsDetectorData.h"
#ifdef RAWDATA
#define DATA_OFFSET sizeof(header)
#endif
#ifndef RAWDATA
#define DATA_OFFSET 0
#endif
class moench03v2Data : public slsDetectorData<uint16_t> {
private:
int iframe;
const int nRows;
double ghost[200][25];
// Single point of definition if we need to customize
#ifndef MYROOT
using header = sls::defs::sls_receiver_header;
#endif
#ifdef MYROOT
sls_receiver_header header;
#endif
public:
/**
Implements the slsReceiverData structure for the moench02 prototype read
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
1286 large etc.) \param c crosstalk parameter for the output buffer
*/
moench03v2Data(int nrows = 200)
: slsDetectorData<uint16_t>(400, nrows*2,2* 400*nrows*2 + DATA_OFFSET),
nRows(nrows) {
std::cout << "MOENCH width new firmware " << dataSize << std::endl;
int off=DATA_OFFSET;
for (int ix = 0; ix < 400; ix++) {
for (int iy = 0; iy < nRows*2; iy++) {
dataMap[iy][ix]=off+2*(iy*400+ix);
}
}
iframe = 0;
// cout << "data struct created" << endl;
};
/**
Returns the value of the selected channel for the given dataset as
double. \param data pointer to the dataset (including headers etc) \param
ix pixel number in the x direction \param iy pixel number in the y
direction \returns data for the selected channel, with inversion if
required as double
*/
double getValue(char *data, int ix, int iy = 0) override {
uint16_t val = getChannel(data, ix, iy) & 0x3fff;
return val;
};
virtual void calcGhost(char *data, int ix, int iy) {
double val = 0;
/* for (int ix=0; ix<25; ix++){ */
/* for (int iy=0; iy<200; iy++) { */
val = 0;
// cout << "** ";
for (int isc = 0; isc < 16; isc++) {
// for (int ii=0; ii<2; ii++) {
val += getChannel(data, ix + 25 * isc, iy);
// cout << "(" << isc << "," << val << " " ;
val += getChannel(data, ix + 25 * isc, 399 - iy);
// cout << val << " " ;
// }
}
ghost[iy][ix] = val; //-6224;
// cout << " --"<< endl;
/* } */
/* } */
// cout << "*" << endl;
}
virtual void calcGhost(char *data) {
for (int ix = 0; ix < 25; ix++) {
for (int iy = 0; iy < 200; iy++) {
calcGhost(data, ix, iy);
}
}
// cout << "*" << endl;
}
double getGhost(int ix, int iy) {
if (iy < 200)
return ghost[iy][ix % 25];
if (iy < 400)
return ghost[399 - iy][ix % 25];
return 0;
};
/**
Returns the frame number for the given dataset. Purely virtual func.
\param buff pointer to the dataset
\returns frame number
*/
int getFrameNumber(char *buff) {
#ifdef RAWDATA
return ((sls::defs::sls_receiver_header *)buff)->detHeader.frameNumber;
#endif
#ifndef RAWDATA
return 1;
#endif
}
/**
Returns the packet number for the given dataset. purely virtual func
\param buff pointer to the dataset
\returns packet number number
*/
int getPacketNumber(char *buff) {
#ifdef RAWDATA
return ((sls::defs::sls_receiver_header *)buff)->detHeader.packetNumber;
#endif
#ifndef RAWDATA
return 0;
#endif
}
char *readNextFrame(std::ifstream &filebin) override {
int ff = -1, np = -1;
return readNextFrame(filebin, ff, np);
}
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff) {
int np = -1;
return readNextFrame(filebin, ff, np);
};
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np) {
char *data = new char[dataSize];
char *d = readNextFrame(filebin, ff, np, data);
if (d == NULL) {
delete[] data;
data = NULL;
}
return data;
}
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np,
char *data) {
np = 0;
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {
ff = getFrameNumber(data);
np = getPacketNumber(data);
// std::cout << "**" << ff << " " << dataSize << " " << ff << " " << np << std::endl;
return data;
}
}
std::cout << "**" << ff << " " << dataSize << " " << ff << " " << np << std::endl;
return nullptr;
}
/**
Loops over a memory slot until a complete frame is found (i.e. all
packets 0 to nPackets, same frame number). purely virtual func \param
data pointer to the memory to be analyzed \param ndata reference to the
amount of data found for the frame, in case the frame is incomplete at
the end of the memory slot \param dsize size of the memory slot to be
analyzed \returns pointer to the beginning of the last good frame (might
be incomplete if ndata smaller than dataSize), or NULL if no frame is
found
*/
char *findNextFrame(char *data, int &ndata, int dsize) override {
if (dsize < dataSize)
ndata = dsize;
else
ndata = dataSize;
return data;
}
// int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
};
#endif

View File

@ -1,240 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#ifndef MOENCH03v2DATA_H
#define MOENCH03v2DATA_H
//#define MYROOT
#ifndef MYROOT
#include "sls/sls_detector_defs.h"
#endif
#ifdef MYROOT
typedef struct {
uint64_t frameNumber;
uint32_t expLength;
uint32_t packetNumber;
uint64_t bunchId;
uint64_t timestamp;
uint16_t modId;
uint16_t row;
uint16_t column;
uint16_t reserved;
uint32_t debug;
uint16_t roundRNumber;
uint8_t detType;
uint8_t version;
} sls_detector_header;
#define MAX_NUM_PACKETS 512
// using sls_bitset = std::bitset<MAX_NUM_PACKETS>;
// using bitset_storage = uint8_t[MAX_NUM_PACKETS / 8];
struct sls_receiver_header {
sls_detector_header detHeader; /**< is the detector header */
uint8_t packetsMask[64]; /**< is the packets caught bit mask */
};
#endif
#include "slsDetectorData.h"
#ifdef RAWDATA
#define DATA_OFFSET sizeof(header)
#endif
#ifndef RAWDATA
#define DATA_OFFSET 0
#endif
class moench03v2Data : public slsDetectorData<uint16_t> {
private:
int iframe;
const int nRows;
double ghost[200][25];
// Single point of definition if we need to customize
#ifndef MYROOT
using header = sls::defs::sls_receiver_header;
#endif
#ifdef MYROOT
sls_receiver_header header;
#endif
public:
/**
Implements the slsReceiverData structure for the moench02 prototype read
out by a module i.e. using the slsReceiver (160x160 pixels, 40 packets
1286 large etc.) \param c crosstalk parameter for the output buffer
*/
moench03v2Data(int nrows = 200)
: slsDetectorData<uint16_t>(400, nrows*2,2* 400*nrows*2 + DATA_OFFSET),
nRows(nrows) {
std::cout << "MOENCH width new firmware " << dataSize << std::endl;
int off=DATA_OFFSET;
for (int ix = 0; ix < 400; ix++) {
for (int iy = 0; iy < nRows*2; iy++) {
dataMap[iy][ix]=off+2*(iy*400+ix);
}
}
iframe = 0;
// cout << "data struct created" << endl;
};
/**
Returns the value of the selected channel for the given dataset as
double. \param data pointer to the dataset (including headers etc) \param
ix pixel number in the x direction \param iy pixel number in the y
direction \returns data for the selected channel, with inversion if
required as double
*/
double getValue(char *data, int ix, int iy = 0) override {
uint16_t val = getChannel(data, ix, iy) & 0x3fff;
return val;
};
virtual void calcGhost(char *data, int ix, int iy) {
double val = 0;
/* for (int ix=0; ix<25; ix++){ */
/* for (int iy=0; iy<200; iy++) { */
val = 0;
// cout << "** ";
for (int isc = 0; isc < 16; isc++) {
// for (int ii=0; ii<2; ii++) {
val += getChannel(data, ix + 25 * isc, iy);
// cout << "(" << isc << "," << val << " " ;
val += getChannel(data, ix + 25 * isc, 399 - iy);
// cout << val << " " ;
// }
}
ghost[iy][ix] = val; //-6224;
// cout << " --"<< endl;
/* } */
/* } */
// cout << "*" << endl;
}
virtual void calcGhost(char *data) {
for (int ix = 0; ix < 25; ix++) {
for (int iy = 0; iy < 200; iy++) {
calcGhost(data, ix, iy);
}
}
// cout << "*" << endl;
}
double getGhost(int ix, int iy) {
if (iy < 200)
return ghost[iy][ix % 25];
if (iy < 400)
return ghost[399 - iy][ix % 25];
return 0;
};
/**
Returns the frame number for the given dataset. Purely virtual func.
\param buff pointer to the dataset
\returns frame number
*/
int getFrameNumber(char *buff) {
#ifdef RAWDATA
return ((sls::defs::sls_receiver_header *)buff)->detHeader.frameNumber;
#endif
#ifndef RAWDATA
return 1;
#endif
}
/**
Returns the packet number for the given dataset. purely virtual func
\param buff pointer to the dataset
\returns packet number number
*/
int getPacketNumber(char *buff) {
#ifdef RAWDATA
return ((sls::defs::sls_receiver_header *)buff)->detHeader.packetNumber;
#endif
#ifndef RAWDATA
return 0;
#endif
}
char *readNextFrame(std::ifstream &filebin) override {
int ff = -1, np = -1;
return readNextFrame(filebin, ff, np);
}
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff) {
int np = -1;
return readNextFrame(filebin, ff, np);
};
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np) {
char *data = new char[dataSize];
char *d = readNextFrame(filebin, ff, np, data);
if (d == NULL) {
delete[] data;
data = NULL;
}
return data;
}
// not present in base class
virtual char *readNextFrame(std::ifstream &filebin, int &ff, int &np,
char *data) {
np = 0;
if (filebin.is_open()) {
if (filebin.read(data, dataSize)) {
ff = getFrameNumber(data);
np = getPacketNumber(data);
std::cout << "**" << ff << " " << dataSize << " " << ff << " " << np << std::endl;
return data;
}
}
std::cout << "**" << ff << " " << dataSize << " " << ff << " " << np << std::endl;
return nullptr;
}
/**
Loops over a memory slot until a complete frame is found (i.e. all
packets 0 to nPackets, same frame number). purely virtual func \param
data pointer to the memory to be analyzed \param ndata reference to the
amount of data found for the frame, in case the frame is incomplete at
the end of the memory slot \param dsize size of the memory slot to be
analyzed \returns pointer to the beginning of the last good frame (might
be incomplete if ndata smaller than dataSize), or NULL if no frame is
found
*/
char *findNextFrame(char *data, int &ndata, int dsize) override {
if (dsize < dataSize)
ndata = dsize;
else
ndata = dataSize;
return data;
}
// int getPacketNumber(int x, int y) {return dataMap[y][x]/packetSize;};
};
#endif

View File

@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
#ifndef FF #ifndef FF
if (argc < 9) { if (argc < 9) {
cout << "Wrong usage! Should be: " << argv[0] cout << "Wrong usage! Should be: " << argv[0]
<< " infile etafile outfile runmin runmax ns [cmin cmax xmin xmax ymin ymax]" << endl; << " infile etafile outfile runmin runmax ns cmin cmax" << endl;
return 1; return 1;
} }
#endif #endif
@ -41,7 +41,7 @@ int main(int argc, char *argv[]) {
#ifdef FF #ifdef FF
if (argc < 7) { if (argc < 7) {
cout << "Wrong usage! Should be: " << argv[0] cout << "Wrong usage! Should be: " << argv[0]
<< " infile etafile runmin runmax [cmin cmax xmin xmax ymin ymax]" << endl; << " infile etafile runmin runmax cmin cmax" << endl;
return 1; return 1;
} }
#endif #endif
@ -65,30 +65,13 @@ int main(int argc, char *argv[]) {
nsubpix = atoi(argv[iarg++]); nsubpix = atoi(argv[iarg++]);
cout << "Subpix: " << nsubpix << endl; cout << "Subpix: " << nsubpix << endl;
#endif #endif
float cmin = atof(argv[iarg++]);
float cmin = 0; float cmax = atof(argv[iarg++]);
float cmax=1000000;
if (argc>iarg)
cmin=atof(argv[iarg++]);
if (argc>iarg)
cmax= atof(argv[iarg++]);
cout << "Energy min: " << cmin << endl; cout << "Energy min: " << cmin << endl;
cout << "Energy max: " << cmax << endl; cout << "Energy max: " << cmax << endl;
int xmin=0, xmax=NC, ymin=0, ymax=NR;
if (argc>iarg)
xmin=atof(argv[iarg++]);
if (argc>iarg)
xmax= atof(argv[iarg++]);
if (argc>iarg)
ymin=atof(argv[iarg++]);
if (argc>iarg)
ymax= atof(argv[iarg++]);
// int etabins=500; // int etabins=500;
int etabins = 1000; // nsubpix*2*100; int etabins = 1000; // nsubpix*2*100;
double etamin = -0.25, etamax = 1.25; double etamin = -1, etamax = 2;
// double etamin=-0.1, etamax=1.1; // double etamin=-0.1, etamax=1.1;
// double eta3min = -2, eta3max = 2; // double eta3min = -2, eta3max = 2;
double sum, totquad; double sum, totquad;
@ -97,7 +80,7 @@ int main(int argc, char *argv[]) {
// double eta3x, eta3y, int3_x, int3_y, noint_x, noint_y; // double eta3x, eta3y, int3_x, int3_y, noint_x, noint_y;
int ix, iy, isx, isy; int ix, iy, isx, isy;
int nframes = 0, lastframe = -1, iframe, nphFrame; int nframes = 0, lastframe = -1;
//double d_x, d_y, res = 5, xx, yy; //double d_x, d_y, res = 5, xx, yy;
int nph = 0, totph = 0; int nph = 0, totph = 0;
//badph = 0, //badph = 0,
@ -124,8 +107,8 @@ int main(int argc, char *argv[]) {
noInterpolation *interp = new noInterpolation(NC, NR, nsubpix); noInterpolation *interp = new noInterpolation(NC, NR, nsubpix);
#endif #endif
int quad;
#ifndef FF #ifndef FF
int quad;
#ifndef NOINTERPOLATION #ifndef NOINTERPOLATION
char fname[10000]; char fname[10000];
int ok; int ok;
@ -159,26 +142,19 @@ int main(int argc, char *argv[]) {
#endif #endif
int irun; int irun;
for (irun = runmin; irun <= runmax; irun++) { for (irun = runmin; irun < runmax; irun++) {
sprintf(infname, argv[1], irun); sprintf(infname, argv[1], irun);
#ifndef FF #ifndef FF
sprintf(outfname, argv[3], irun); sprintf(outfname, argv[3], irun);
#endif #endif
f = fopen(infname, "r"); f = fopen(infname, "r");
if (f) { if (f) {
cout << infname << endl; cout << infname << endl;
nframes = 0; nframes = 0;
//f0 = -1; //f0 = -1;
//iff=0; while (cl.read(f)) {
while (fread((void*)&iframe, 1, sizeof(int), f)) {
//n=0;
if (fread((void*)&nphFrame, 1, sizeof(int), f)) {
for (int iph=0; iph<nphFrame; iph++) {
//while (cl.read(f)) {
if (cl.read(f)) {
totph++; totph++;
if (lastframe != cl.iframe) { if (lastframe != cl.iframe) {
lastframe = cl.iframe; lastframe = cl.iframe;
@ -189,27 +165,17 @@ int main(int argc, char *argv[]) {
nframes++; nframes++;
} }
// quad=interp->calcQuad(cl.get_cluster(), sum, totquad, sDum); // quad=interp->calcQuad(cl.get_cluster(), sum, totquad, sDum);
// #ifndef FF #ifndef FF
// quad = interp->calcEta(cl.get_cluster(), etax, etay, sum,
// totquad, sDum);
// #endif
// #ifdef FF
quad = interp->calcEta(cl.get_cluster(), etax, etay, sum, quad = interp->calcEta(cl.get_cluster(), etax, etay, sum,
totquad, sDum); totquad, sDum);
#endif
#ifdef FF
interp->calcEta(cl.get_cluster(), etax, etay, sum,
totquad, sDum);
#endif
if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 &&
/* cl.print(); sum < cmax) {
cout << "(" << etax <<","<< etay <<")"<< quad<< endl;
*/
//#endif
if (totquad > cmin && cl.x >= xmin && cl.x <= xmax &&
cl.y >= ymin && cl.y <= ymax &&
totquad < cmax) {
// if (sum > cmin && totquad / sum > 0.8 && totquad / sum < 1.2 &&
// sum < cmax) {
nph++; nph++;
// if (sum>200 && sum<580) { // if (sum>200 && sum<580) {
// interp->getInterpolatedPosition(cl.x,cl.y, // interp->getInterpolatedPosition(cl.x,cl.y,
@ -264,9 +230,6 @@ int main(int argc, char *argv[]) {
} }
} }
} }
}
}
}
fclose(f); fclose(f);
#ifdef FF #ifdef FF

View File

@ -13,7 +13,7 @@
#ifndef MOENCH04 #ifndef MOENCH04
#ifndef RECT #ifndef RECT
#include "moench03v2Data.h" #include "moench03T1ReceiverDataNew.h"
#endif #endif
#endif #endif
@ -41,54 +41,7 @@ using namespace std;
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
std::map<std::string, std::string> args = {
{"numfiles","1"},
{"nthreads","5"},
{"fifosize","5000"},
{"nsigma","5"},
{"gainfile","none"},
{"detectorMode","counting"},
{"threshold","0"},
{"pedestalfile","none"},
{"nframes","0"},
{"xMin","0"},
{"xMax","400"},
{"yMin","0"},
{"yMax","400"},
{"eMin","0"},
{"eMax","16000"},
{"outdir","./"},
{"indir","./"},
{"flist","none"},
{"fformat","none"},
{"runmin","0"},
{"runmax","-1"},
{"readnrows","400"}
};
//float *gm;
int ff, np;
// cout << " data size is " << dsize;
ifstream filebin;
if (argc < 4) { if (argc < 4) {
std::string name, value,sline;
int ic=0;
ifstream flist;
flist.open (argv[1], std::ifstream::in);
if (flist.is_open()) {
cout << "Using config file " <<argv[1] << endl;
while (std::getline(flist,sline)){
if (sline.at(0)!='#') {
ic=sline.find(' ');
name = sline.substr(0,ic);
value = sline.substr(ic+1,sline.size()-ic);
args[name]=value;
}
}
flist.close();
} else {
cout << "Usage is " << argv[0] cout << "Usage is " << argv[0]
<< "indir outdir fname(no extension) [runmin] [runmax] [pedfile (raw or tiff)] [threshold] " << "indir outdir fname(no extension) [runmin] [runmax] [pedfile (raw or tiff)] [threshold] "
"[nframes] [xmin xmax ymin ymax] [gainmap]" "[nframes] [xmin xmax ymin ymax] [gainmap]"
@ -99,90 +52,23 @@ int main(int argc, char *argv[]) {
cout << "nframes <0 means sum everything; nframes=0 means one file per " cout << "nframes <0 means sum everything; nframes=0 means one file per "
"run; nframes>0 means one file every nframes" "run; nframes>0 means one file every nframes"
<< endl; << endl;
return EXIT_FAILURE; return 1;
}
} else {
args["indir"]=argv[1];
args["outdir"]=argv[1];
args["fformat"]=argv[3];
if (argc >= 5) {
args["runmin"] = argv[4];
}
args["runmax"] = args["runmin"];
if (argc >= 6) {
args["runmax"] = argv[5];
}
if (argc >= 7) {
args["pedestalfile"] = argv[6];
}
if (argc >= 8) {
args["threshold"] = argv[7];
}
if (argc >= 9) {
args["nframes"] = argv[8];
}
if (argc >= 13) {
args["xMin"] = argv[9];
args["xMax"] = argv[10];
args["yMin"] = argv[11];
args["yMax"] = argv[12];
}
if (argc > 13) {
args["gainfile"] = argv[13];
} }
if (atof(args["threshold"].c_str())<0) { int fifosize = 1000;
args["detectorMode"]="analog"; int nthreads = 10;
}
}
for (auto const& x : args)
{
std::cout << x.first // string (key)
<< ':'
<< x.second // string's value
<< std::endl;
}
string indir=args["indir"];
string outdir = args["outdir"];
string fformat= args["fformat"];
int runmin = atoi(args["runmin"].c_str());
int runmax = atoi(args["runmin"].c_str());
string pedfile =args["pedestalfile"];
double thr = atof(args["threshold"].c_str());
double thr1 = 1;
int nframes = atoi(args["nframes"].c_str());
int xmin = atoi(args["xMin"].c_str()), xmax = atoi(args["xMax"].c_str()), ymin = atoi(args["yMin"].c_str()), ymax = atoi(args["yMax"].c_str());
string gainfname=args["gainfile"];
int fifosize = atoi(args["fifosize"].c_str());
int nthreads = atoi(args["nthreads"].c_str());
int nsigma = atoi(args["nsigma"].c_str());
int nrows = atoi(args["readnrows"].c_str());
float eMin = atof(args["eMin"].c_str());
float eMax = atof(args["eMax"].c_str());
int csize = 3; int csize = 3;
int nped = 1000; int nsigma = 5;
int nped = 10000;
int cf = 0; int cf = 0;
int numberOfPackets=40;
int numberOfPackets=nrows/8;
#ifdef RECT #ifdef RECT
cout << "Should be rectangular but now it will crash! No data structure defined!" << endl; cout << "Should be rectangular but now it will crash! No data structure defined!" << endl;
#endif #endif
#ifndef MOENCH04 #ifndef MOENCH04
moench03v2Data *decoder = new moench03v2Data(100); moench03T1ReceiverDataNew *decoder = new moench03T1ReceiverDataNew();
cout << "MOENCH03!" << endl; cout << "MOENCH03!" << endl;
#endif #endif
@ -200,10 +86,62 @@ int main(int argc, char *argv[]) {
#endif #endif
//Read detector size from decoder
int nx , ny; int nx , ny;
decoder->getDetectorSize(nx, ny); decoder->getDetectorSize(nx, ny);
//Read detector size from decoder //float *gm;
int ff, np;
// cout << " data size is " << dsize;
ifstream filebin;
char *indir = argv[1];
char *outdir = argv[2];
char *fformat = argv[3];
int runmin = 0;
// cout << "argc is " << argc << endl;
if (argc >= 5) {
runmin = atoi(argv[4]);
}
int runmax = runmin;
if (argc >= 6) {
runmax = atoi(argv[5]);
}
char *pedfile = NULL;
if (argc >= 7) {
pedfile = argv[6];
}
double thr = 0;
double thr1 = 1;
if (argc >= 8) {
thr = atof(argv[7]);
}
int nframes = 0;
if (argc >= 9) {
nframes = atoi(argv[8]);
}
int xmin = 0, xmax = nx, ymin = 0, ymax = ny;
if (argc >= 13) {
xmin = atoi(argv[9]);
xmax = atoi(argv[10]);
ymin = atoi(argv[11]);
ymax = atoi(argv[12]);
}
char *gainfname = NULL;
if (argc > 13) {
gainfname = argv[13];
cout << "Gain map file name is: " << gainfname << endl;
}
char ffname[10000]; char ffname[10000];
char fname[10000]; char fname[10000];
@ -213,6 +151,17 @@ int main(int argc, char *argv[]) {
std::time_t end_time; std::time_t end_time;
FILE *of = NULL; FILE *of = NULL;
cout << "input directory is " << indir << endl;
cout << "output directory is " << outdir << endl;
cout << "input file is " << fformat << endl;
cout << "runmin is " << runmin << endl;
cout << "runmax is " << runmax << endl;
if (pedfile)
cout << "pedestal file is " << pedfile << endl;
if (thr > 0)
cout << "threshold is " << thr << endl;
cout << "Nframes is " << nframes << endl;
uint32_t nnx, nny; uint32_t nnx, nny;
@ -233,13 +182,13 @@ int main(int argc, char *argv[]) {
singlePhotonDetector *filter = new singlePhotonDetector( singlePhotonDetector *filter = new singlePhotonDetector(
decoder, csize, nsigma, 1, cm, nped, 200, -1, -1, gainmap, gs); decoder, csize, nsigma, 1, cm, nped, 200, -1, -1, gainmap, gs);
//if (gainfname) { if (gainfname) {
if (filter->readGainMap(gainfname.c_str())) if (filter->readGainMap(gainfname))
cout << "using gain map " << gainfname << endl; cout << "using gain map " << gainfname << endl;
else else
cout << "Could not open gain map " << gainfname << endl; cout << "Could not open gain map " << gainfname << endl;
// } else } else
thr = 0.15 * thr; thr = 0.15 * thr;
filter->newDataSet(); filter->newDataSet();
//int dsize = decoder->getDataSize(); //int dsize = decoder->getDataSize();
@ -248,11 +197,11 @@ int main(int argc, char *argv[]) {
cout << "threshold is " << thr << endl; cout << "threshold is " << thr << endl;
filter->setThreshold(thr); filter->setThreshold(thr);
cf = 0; cf = 0;
} else } else
cf = 1; cf = 1;
filter->setROI(xmin, xmax, ymin, ymax); filter->setROI(xmin, xmax, ymin, ymax);
filter->setEnergyRange(eMin, eMax);
std::time(&end_time); std::time(&end_time);
cout << std::ctime(&end_time) << endl; cout << std::ctime(&end_time) << endl;
@ -262,33 +211,21 @@ int main(int argc, char *argv[]) {
// multiThreadedAnalogDetector(filter,nthreads,fifosize); // multiThreadedAnalogDetector(filter,nthreads,fifosize);
multiThreadedCountingDetector *mt = multiThreadedCountingDetector *mt =
new multiThreadedCountingDetector(filter, nthreads, fifosize); new multiThreadedCountingDetector(filter, nthreads, fifosize);
#ifndef ANALOG
if (args["detectorMode"]=="counting") {
mt->setDetectorMode(ePhotonCounting); mt->setDetectorMode(ePhotonCounting);
cout << "Counting!" << endl;
if (thr > 0) { if (thr > 0) {
cf = 0; cf = 0;
} }
} else { #endif
//{
#ifdef ANALOG
mt->setDetectorMode(eAnalog); mt->setDetectorMode(eAnalog);
cout << "Analog!" << endl;
cf = 0; cf = 0;
} // thr1=thr;
#endif
// #ifndef ANALOG
// mt->setDetectorMode(ePhotonCounting);
// cout << "Counting!" << endl;
// if (thr > 0) {
// cf = 0;
// } // }
// #endif
// //{
// #ifdef ANALOG
// mt->setDetectorMode(eAnalog);
// cout << "Analog!" << endl;
// cf = 0;
// // thr1=thr;
// #endif
// // }
mt->StartThreads(); mt->StartThreads();
mt->popFree(buff); mt->popFree(buff);
@ -299,19 +236,18 @@ int main(int argc, char *argv[]) {
char froot[1000]; char froot[1000];
double *ped=new double[nx * ny];//, *ped1; double *ped=new double[nx * ny];//, *ped1;
int pos,pos1; int pos,pos1;
//return 0;
if (pedfile.find(".raw") != std::string::npos) { if (pedfile) {
pos1=pedfile.rfind("/"); if (string(pedfile).find(".raw") != std::string::npos) {
strcpy(froot,pedfile.substr(pos1).c_str()); pos1=string(pedfile).rfind("/");
strcpy(froot,pedfile+pos1);
pos=string(froot).find(".raw"); pos=string(froot).find(".raw");
froot[pos]='\0'; froot[pos]='\0';
} }
cout << "PEDESTAL " << endl; cout << "PEDESTAL " << endl;
if (pedfile.find(".tif") == std::string::npos) { if (string(pedfile).find(".tif") == std::string::npos) {
sprintf(fname, "%s", pedfile.c_str()); sprintf(fname, "%s", pedfile);
cout << fname << endl; cout << fname << endl;
std::time(&end_time); std::time(&end_time);
//cout << "aaa" << std::ctime(&end_time) << endl; //cout << "aaa" << std::ctime(&end_time) << endl;
@ -323,38 +259,31 @@ int main(int argc, char *argv[]) {
if (filebin.is_open()) { if (filebin.is_open()) {
ff = -1; ff = -1;
while (decoder->readNextFrame(filebin, ff, np, buff)) { while (decoder->readNextFrame(filebin, ff, np, buff)) {
if (np == numberOfPackets) { if (np == numberOfPackets) {
mt->pushData(buff); mt->pushData(buff);
mt->nextThread(); mt->nextThread();
mt->popFree(buff); mt->popFree(buff);
ifr++; ifr++;
if (ifr % 100 == 0) if (ifr % 100 == 0)
cout << ifr << " " << ff << " " << np << endl; cout << ifr << " " << ff << " " << np << endl;
// break; } else
} else {
cout << ifr << " " << ff << " " << np << endl; cout << ifr << " " << ff << " " << np << endl;
break;
}
ff = -1; ff = -1;
} }
filebin.close(); filebin.close();
while (mt->isBusy()) { while (mt->isBusy()) {
; ;
} }
sprintf(imgfname, "%s/%s_ped.tiff", outdir.c_str(),froot); sprintf(imgfname, "%s/%s_ped.tiff", outdir,froot);
mt->writePedestal(imgfname); mt->writePedestal(imgfname);
sprintf(imgfname, "%s/%s_var.tiff", outdir.c_str(),froot); sprintf(imgfname, "%s/%s_var.tiff", outdir,froot);
mt->writePedestalRMS(imgfname); mt->writePedestalRMS(imgfname);
} else } else
cout << "Could not open pedestal file " << fname cout << "Could not open pedestal file " << fname
<< " for reading " << endl; << " for reading " << endl;
} else { } else {
float *pp = ReadFromTiff(pedfile.c_str(), nny, nnx); float *pp = ReadFromTiff(pedfile, nny, nnx);
if (pp && (int)nnx == nx && (int)nny == ny) { if (pp && (int)nnx == nx && (int)nny == ny) {
for (int i = 0; i < nx * ny; i++) { for (int i = 0; i < nx * ny; i++) {
ped[i] = pp[i]; ped[i] = pp[i];
@ -369,52 +298,22 @@ int main(int argc, char *argv[]) {
} }
std::time(&end_time); std::time(&end_time);
cout << std::ctime(&end_time) << endl; cout << std::ctime(&end_time) << endl;
}
ifr = 0; ifr = 0;
int ifile = 0; int ifile = 0;
mt->setFrameMode(eFrame); mt->setFrameMode(eFrame);
//t filelist=0;
ifstream flist;
flist.open (args["flist"].c_str(), std::ifstream::in);
if (flist.is_open()) {
cout << "Using file list" << endl;
runmin=0;
runmax=0;
while (flist.getline(ffname,10000)){
cout << ffname << endl;
runmax++;
}
runmax--;
flist.close();
cout << "Found " << runmax << " files " << endl;
flist.open (fformat, std::ifstream::in);
}
for (int irun = runmin; irun <= runmax; irun++) { for (int irun = runmin; irun <= runmax; irun++) {
cout << "DATA "; cout << "DATA ";
// sprintf(fn,fformat,irun); // sprintf(fn,fformat,irun);
// sprintf(ffname, "%s/%s.raw", indir, fformat); sprintf(ffname, "%s/%s.raw", indir, fformat);
// sprintf(fname, (const char*)ffname, irun); sprintf(fname, (const char*)ffname, irun);
// sprintf(ffname, "%s/%s.tiff", outdir, fformat); sprintf(ffname, "%s/%s.tiff", outdir, fformat);
// sprintf(imgfname, (const char*)ffname, irun); sprintf(imgfname, (const char*)ffname, irun);
// sprintf(ffname, "%s/%s.clust", outdir, fformat); sprintf(ffname, "%s/%s.clust", outdir, fformat);
// sprintf(cfname, (const char*)ffname, irun); sprintf(cfname, (const char*)ffname, irun);
if (flist.is_open()) {
flist.getline(ffname,10000);
cout << "file list " << ffname << endl;
} else {
//sprintf(ffname,(const char*)fformat,irun);
sprintf(ffname,args["fformat"].c_str(),irun);
cout << "loop " << ffname << endl;
}
cout << "ffname "<< ffname << endl;
sprintf(fname, "%s/%s.raw",indir.c_str(),ffname);
sprintf(imgfname, "%s/%s.tiff",outdir.c_str(),ffname);
sprintf(cfname, "%s/%s.clust",outdir.c_str(),ffname);
cout << fname << " "; cout << fname << " ";
cout << imgfname << endl; cout << imgfname << endl;
std::time(&end_time); std::time(&end_time);
@ -424,7 +323,7 @@ int main(int argc, char *argv[]) {
// //open file // //open file
ifile = 0; ifile = 0;
if (filebin.is_open()) { if (filebin.is_open()) {
if (cf != 0) { // cluster finder if (thr <= 0 && cf != 0) { // cluster finder
if (of == NULL) { if (of == NULL) {
of = fopen(cfname, "w"); of = fopen(cfname, "w");
if (of) { if (of) {
@ -442,7 +341,6 @@ int main(int argc, char *argv[]) {
ff = -1; ff = -1;
ifr = 0; ifr = 0;
while (decoder->readNextFrame(filebin, ff, np, buff)) { while (decoder->readNextFrame(filebin, ff, np, buff)) {
if (np == numberOfPackets) { if (np == numberOfPackets) {
// //push // //push
mt->pushData(buff); mt->pushData(buff);
@ -452,17 +350,12 @@ int main(int argc, char *argv[]) {
ifr++; ifr++;
if (ifr % 100 == 0) if (ifr % 100 == 0)
cout << ifr << " " << ff << " " << np << endl; cout << ifr << " " << ff << endl;
//break;
if (nframes > 0) { if (nframes > 0) {
if (ifr % nframes == 0) { if (ifr % nframes == 0) {
// sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat, sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat,
// ifile); ifile);
// sprintf(imgfname, (const char*)ffname, irun); sprintf(imgfname, (const char*)ffname, irun);
sprintf(imgfname, "%s/%s_f%05d.tiff",outdir.c_str(),ffname,ifile);
while (mt->isBusy())
;
mt->writeImage(imgfname, thr1); mt->writeImage(imgfname, thr1);
mt->clearImage(); mt->clearImage();
ifile++; ifile++;
@ -470,7 +363,6 @@ int main(int argc, char *argv[]) {
} }
} else { } else {
cout << "bp " << ifr << " " << ff << " " << np << endl; cout << "bp " << ifr << " " << ff << " " << np << endl;
//break; //break;
} }
ff = -1; ff = -1;
@ -482,17 +374,13 @@ int main(int argc, char *argv[]) {
} }
if (nframes >= 0) { if (nframes >= 0) {
if (nframes > 0) { if (nframes > 0) {
sprintf(imgfname, "%s/%s_f%05d.tiff",outdir.c_str(),ffname,ifile); sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat, ifile);
// sprintf(ffname, "%s/%s_f%05d.tiff", outdir, fformat, ifile); sprintf(imgfname, (const char*)ffname, irun);
//sprintf(imgfname, (const char*)ffname, irun);
} else { } else {
sprintf(imgfname, "%s/%s.tiff",outdir.c_str(),ffname); sprintf(ffname, "%s/%s.tiff", outdir, fformat);
// sprintf(ffname, "%s/%s.tiff", outdir, fformat); sprintf(imgfname, (const char*)ffname, irun);
// sprintf(imgfname, (const char*)ffname, irun);
} }
cout << "Writing tiff to " << imgfname << " " << thr1 << endl; cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
while (mt->isBusy())
;
mt->writeImage(imgfname, thr1); mt->writeImage(imgfname, thr1);
mt->clearImage(); mt->clearImage();
if (of) { if (of) {
@ -507,16 +395,11 @@ int main(int argc, char *argv[]) {
cout << "Could not open " << fname << " for reading " << endl; cout << "Could not open " << fname << " for reading " << endl;
} }
if (nframes < 0) { if (nframes < 0) {
//sprintf(ffname, "%s/%s.tiff", outdir, fformat); sprintf(ffname, "%s/%s.tiff", outdir, fformat);
// strcpy(imgfname, ffname); strcpy(imgfname, ffname);
sprintf(imgfname, "%s/%s_tot.tiff",outdir.c_str(),ffname);
cout << "Writing tiff to " << imgfname << " " << thr1 << endl; cout << "Writing tiff to " << imgfname << " " << thr1 << endl;
while (mt->isBusy())
;
mt->writeImage(imgfname, thr1); mt->writeImage(imgfname, thr1);
} }
if (flist.is_open()) {
flist.close();
}
return 0; return 0;
} }

View File

@ -13,8 +13,7 @@
#include "sls/sls_detector_defs.h" #include "sls/sls_detector_defs.h"
#ifndef MOENCH04 #ifndef MOENCH04
//#ifndef RECT //#ifndef RECT
#include "moench03v2Data.h" #include "moench03T1ZmqDataNew.h"
//#include "moench03T1ZmqDataNew.h"
//#endif //#endif
//#ifdef RECT //#ifdef RECT
//#include "moench03T1ZmqDataNewRect.h" //#include "moench03T1ZmqDataNewRect.h"
@ -32,7 +31,6 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <vector> #include <vector>
#include <map>
#include <rapidjson/document.h> //json header in zmq stream #include <rapidjson/document.h> //json header in zmq stream
@ -66,47 +64,35 @@ int main(int argc, char *argv[]) {
* number] * number]
* *
*/ */
std::map<std::string, std::string> args = {
{"numinterfaces","1"},
{"rx_zmqip","10.1.2.102"},
{"rx_zmqport","7770"},
{"zmqip","129.129.202.153"},
{"zmqport","7780"},
{"nthreads","5"},
{"fifosize","5000"},
{"nsigma","5"},
{"gainfile","none"},
{"nbinsx","5"},
{"nbinsy","5"},
{"etafile","none"},
{"etabinsx","1000"},
{"etamin","-1"},
{"etamax","2"} };
FILE *of = NULL; FILE *of = NULL;
int fifosize = 5000;
int etabins = 1000, etabinsy = 1000; // nsubpix*2*100; int etabins = 1000, etabinsy = 1000; // nsubpix*2*100;
double etamin = -1, etamax = 2; double etamin = -1, etamax = 2;
int nSubPixelsX = 2; int nSubPixelsX = 2;
int emin, emax; int emin, emax;
int nSubPixelsY = 2; int nSubPixelsY = 2;
int nthreads = 5;
int fifosize = 5000;
uint32_t nSigma = 5;
string etafname;// = NULL; // help
string gainfname;// = NULL; if (argc < 3) {
cprintf(RED, "Help: ./trial [receive socket ip] [receive starting port "
"number] [send_socket ip] [send starting port number] "
"[nthreads] [nsubpix] [gainmap] [etafile]\n");
return EXIT_FAILURE;
}
// receive parameters // receive parameters
bool send = false; bool send = false;
char *socketip = argv[1];
uint32_t portnum = atoi(argv[2]);
// send parameters if any // send parameters if any
string socketip2;// = 0; char *socketip2 = 0;
uint32_t portnum2 = 0; uint32_t portnum2 = 0;
string socketip;// = 0;
uint32_t portnum = 0;
sls::zmqHeader zHeader, outHeader; sls::zmqHeader zHeader, outHeader;
zHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION; zHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION;
outHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION; outHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION;
uint32_t nSigma = 5;
int ok; int ok;
@ -116,85 +102,48 @@ int main(int argc, char *argv[]) {
// time_t begin,end,finished; // time_t begin,end,finished;
int rms = 0; int rms = 0;
if (argc > 4) {
socketip2 = argv[3];
portnum2 = atoi(argv[4]);
if (portnum2 > 0)
send = true; send = true;
// help
if (argc < 5) {
std::string name, value,sline;
int ic=0;
ifstream flist;
flist.open (argv[1], std::ifstream::in);
if (flist.is_open()) {
cout << "Using config file " <<argv[1] << endl;
while (std::getline(flist,sline)){
if (sline.at(0)!='#') {
ic=sline.find(' ');
name = sline.substr(0,ic);
value = sline.substr(ic+1,sline.size()-ic);
args[name]=value;
} }
cout << "\nrx socket ip : " << socketip << "\nrx port num : " << portnum;
if (send) {
cout << "\ntx socket ip : " << socketip2
<< "\ntx port num : " << portnum2;
} }
flist.close(); int nthreads = 5;
} else {
cprintf(RED, "Arguments are either: \n [config file] \n or the following list (deprecated): [receive socket ip] [receive starting port "
"number] [send_socket ip] [send starting port number] "
"[nthreads] [nsubpix] [gainmap] [etafile]\n");
return EXIT_FAILURE;
}
} else {
args["rx_zmqip"]=argv[1];
args["rx_zmqport"]=argv[2];
args["zmqip"]=argv[3];
args["zmqport"]=argv[4];
if (argc > 5) if (argc > 5)
args["nthreads"] = argv[5]; nthreads = atoi(argv[5]);
cout << "Number of threads is: " << nthreads << endl;
if (argc > 6) { if (argc > 6) {
args["nbinsx"]=argv[6]; nSubPixelsX = atoi(argv[6]);
args["nbinsy"]=argv[6]; nSubPixelsY = nSubPixelsX;
#ifdef RECT
nSubPixelsX = 2;
#endif
} }
cout << "Number of subpixels is: " << nSubPixelsX << " " << nSubPixelsY
<< endl;
char *gainfname = NULL;
if (argc > 7) { if (argc > 7) {
args["gainfile"]=argv[7]; gainfname = argv[7];
cout << "Gain map file name is: " << gainfname << endl;
} }
char *etafname = NULL;
if (argc > 8) { if (argc > 8) {
args["etafilefile"]=argv[8]; etafname = argv[8];
cout << "Eta file name is: " << etafname << endl;
} }
}
for (auto const& x : args)
{
std::cout << x.first // string (key)
<< ':'
<< x.second // string's value
<< std::endl;
}
socketip = args["rx_zmqip"];
portnum = atoi(args["rx_zmqport"].c_str());
socketip2 = args["zmqip"];
portnum2 = atoi(args["zmqport"].c_str());
nthreads = atoi(args["nthreads"].c_str());
nSubPixelsX =atoi(args["nbinsx"].c_str());
nSubPixelsY =atoi(args["nbinsy"].c_str());
gainfname = args["gainfile"];
etafname = args["etafilefile"];
if (atoi(args["nuninterfaces"].c_str())>1){
cprintf(RED, "Sorry, at the moment only a single interface is supported instead of %d\n",atoi(args["nuninterfaces"].c_str()));
return EXIT_FAILURE;
}
// slsDetectorData *det=new moench03T1ZmqDataNew(); // slsDetectorData *det=new moench03T1ZmqDataNew();
#ifndef MOENCH04 #ifndef MOENCH04
cout << "This is a Moench03 v2" << endl; cout << "This is a Moench03" << endl;
//moench03T1ZmqDataNew *det = new moench03T1ZmqDataNew(); moench03T1ZmqDataNew *det = new moench03T1ZmqDataNew();
moench03v2Data *det = new moench03v2Data();
cout << "MOENCH03!" << endl;
#endif #endif
#ifdef MOENCH04 #ifdef MOENCH04
cout << "This is a Moench04" << endl; cout << "This is a Moench04" << endl;
@ -228,8 +177,8 @@ int main(int argc, char *argv[]) {
double *gmap = NULL; double *gmap = NULL;
uint32_t nnnx, nnny; uint32_t nnnx, nnny;
//if (gainfname) { if (gainfname) {
gm = ReadFromTiff(gainfname.c_str(), nnny, nnnx); gm = ReadFromTiff(gainfname, nnny, nnnx);
if (gm && nnnx == (uint)npx && nnny == (uint)npy) { if (gm && nnnx == (uint)npx && nnny == (uint)npy) {
gmap = new double[npx * npy]; gmap = new double[npx * npy];
for (int i = 0; i < npx * npy; i++) { for (int i = 0; i < npx * npy; i++) {
@ -238,7 +187,7 @@ int main(int argc, char *argv[]) {
delete[] gm; delete[] gm;
} else } else
cout << "Could not open gain map " << gainfname << endl; cout << "Could not open gain map " << gainfname << endl;
//} }
// analogDetector<uint16_t> *filter=new // analogDetector<uint16_t> *filter=new
// analogDetector<uint16_t>(det,1,NULL,1000); // analogDetector<uint16_t>(det,1,NULL,1000);
@ -256,8 +205,8 @@ int main(int argc, char *argv[]) {
eta2InterpolationPosXY *interp = new eta2InterpolationPosXY( eta2InterpolationPosXY *interp = new eta2InterpolationPosXY(
npx, npy, nSubPixelsX, nSubPixelsY, etabins, etabinsy, etamin, etamax); npx, npy, nSubPixelsX, nSubPixelsY, etabins, etabinsy, etamin, etamax);
//if (etafname) if (etafname)
interp->readFlatField(etafname.c_str()); interp->readFlatField(etafname);
interpolatingDetector *filter = new interpolatingDetector( interpolatingDetector *filter = new interpolatingDetector(
det, interp, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs); det, interp, nSigma, 1, cm, 1000, 10, -1, -1, gainmap, gs);
@ -277,13 +226,13 @@ int main(int argc, char *argv[]) {
try { try {
#endif #endif
zmqsocket = new sls::ZmqSocket(socketip.c_str(), portnum); zmqsocket = new sls::ZmqSocket(socketip, portnum);
#ifdef NEWZMQ #ifdef NEWZMQ
} catch (...) { } catch (...) {
cprintf(RED, cprintf(RED,
"Error: Could not create Zmq socket on port %d with ip %s\n", "Error: Could not create Zmq socket on port %d with ip %s\n",
portnum, socketip.c_str()); portnum, socketip);
delete zmqsocket; delete zmqsocket;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -293,7 +242,7 @@ int main(int argc, char *argv[]) {
if (zmqsocket->IsError()) { if (zmqsocket->IsError()) {
cprintf(RED, cprintf(RED,
"Error: Could not create Zmq socket on port %d with ip %s\n", "Error: Could not create Zmq socket on port %d with ip %s\n",
portnum, socketip.c_str()); portnum, socketip);
delete zmqsocket; delete zmqsocket;
return EXIT_FAILURE; return EXIT_FAILURE;
} }
@ -314,14 +263,14 @@ int main(int argc, char *argv[]) {
// receive socket // receive socket
try { try {
#endif #endif
zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2.c_str()); zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2);
#ifdef NEWZMQ #ifdef NEWZMQ
} catch (...) { } catch (...) {
cprintf(RED, cprintf(RED,
"Error: Could not create Zmq socket server on port %d and " "Error: Could not create Zmq socket server on port %d and "
"ip %s\n", "ip %s\n",
portnum2, socketip2.c_str()); portnum2, socketip2);
// delete zmqsocket2; // delete zmqsocket2;
// zmqsocket2=NULL; // zmqsocket2=NULL;
// delete zmqsocket; // delete zmqsocket;
@ -335,7 +284,7 @@ int main(int argc, char *argv[]) {
cprintf(RED, cprintf(RED,
"AAA Error: Could not create Zmq socket server on port %d " "AAA Error: Could not create Zmq socket server on port %d "
"and ip %s\n", "and ip %s\n",
portnum2, socketip2.c_str()); portnum2, socketip2);
// delete zmqsocket2; // delete zmqsocket2;
// delete zmqsocket; // delete zmqsocket;
// return EXIT_FAILURE; // return EXIT_FAILURE;
@ -773,25 +722,6 @@ int main(int argc, char *argv[]) {
cprintf(MAGENTA, "%d %d %d %d\n", xmin, xmax, ymin, ymax); cprintf(MAGENTA, "%d %d %d %d\n", xmin, xmax, ymin, ymax);
mt->setROI(xmin, xmax, ymin, ymax); mt->setROI(xmin, xmax, ymin, ymax);
if (addJsonHeader.find("xMin") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("xMin")) >> xmin;
}
if (addJsonHeader.find("yMin") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("yMin")) >> ymin;
}
if (addJsonHeader.find("xMax") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("xMax")) >> xmax;
}
if (addJsonHeader.find("yMax") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("yMax")) >> ymax;
}
if (addJsonHeader.find("dynamicRange") != addJsonHeader.end()) { if (addJsonHeader.find("dynamicRange") != addJsonHeader.end()) {
istringstream(addJsonHeader.at("dynamicRange")) >> dr; istringstream(addJsonHeader.at("dynamicRange")) >> dr;
dr = 32; dr = 32;
@ -891,7 +821,7 @@ int main(int argc, char *argv[]) {
// cout << acqIndex << " " << frameIndex << " " << subFrameIndex << " // cout << acqIndex << " " << frameIndex << " " << subFrameIndex << "
// "<< detSpec1 << " " << timestamp << " " << packetNumber << endl; // "<< detSpec1 << " " << timestamp << " " << packetNumber << endl;
// cprintf(GREEN, "frame\n"); // cprintf(GREEN, "frame\n");
if (packetNumber <= 50) { if (packetNumber >= 40) {
//*((int*)buff)=frameIndex; //*((int*)buff)=frameIndex;
if (insubframe == 0) if (insubframe == 0)
f0 = frameIndex; f0 = frameIndex;

View File

@ -37,7 +37,8 @@ target_compile_definitions(ctbDetectorServer_virtual
) )
target_link_libraries(ctbDetectorServer_virtual target_link_libraries(ctbDetectorServer_virtual
PUBLIC pthread rt m slsProjectCSettings PUBLIC pthread rt slsProjectCSettings
m
) )
set_target_properties(ctbDetectorServer_virtual PROPERTIES set_target_properties(ctbDetectorServer_virtual PROPERTIES

View File

@ -55,9 +55,7 @@
#define DEFAULT_SYNC_CLK (40) // 20 #define DEFAULT_SYNC_CLK (40) // 20
#define DEFAULT_DBIT_CLK (200) #define DEFAULT_DBIT_CLK (200)
#define DEFAULT_TRANSCEIVER_MASK (0x3) #define DEFAULT_TRANSCEIVER_MASK (0x3)
#define MAX_TRANSCEIVER_MASK (0xF) #define MAX_TRANSCEIVER_MASK (0xF)
#define MAX_TRANSCEIVER_SAMPLES (0xFFFF)
#define UDP_HEADER_MAX_FRAME_VALUE (0xFFFFFFFFFFFF) #define UDP_HEADER_MAX_FRAME_VALUE (0xFFFFFFFFFFFF)

View File

@ -471,8 +471,7 @@ void setupDetector() {
// hv // hv
DAC6571_SetDefines(HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME); DAC6571_SetDefines(HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME);
// dacs // dacs
LTC2620_D_SetDefines(DAC_MIN_MV, DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC, 1, LTC2620_D_SetDefines(DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC);
0, "");
// on chip dacs // on chip dacs
ASIC_Driver_SetDefines(ONCHIP_DAC_DRIVER_FILE_NAME); ASIC_Driver_SetDefines(ONCHIP_DAC_DRIVER_FILE_NAME);
setTimingSource(DEFAULT_TIMING_SOURCE); setTimingSource(DEFAULT_TIMING_SOURCE);

View File

@ -35,7 +35,6 @@
#define TEMPERATURE_FILE_NAME ("/sys/class/hwmon/hwmon0/temp1_input") #define TEMPERATURE_FILE_NAME ("/sys/class/hwmon/hwmon0/temp1_input")
#endif #endif
#define CONFIG_FILE ("config_gotthard2.txt") #define CONFIG_FILE ("config_gotthard2.txt")
#define DAC_MIN_MV (0)
#define DAC_MAX_MV (2048) #define DAC_MAX_MV (2048)
#define ONCHIP_DAC_MAX_VAL (0x3FF) #define ONCHIP_DAC_MAX_VAL (0x3FF)
#define ADU_MAX_VAL (0xFFF) #define ADU_MAX_VAL (0xFFF)

View File

@ -61,7 +61,7 @@
#define ASIC_FILTER_MAX_RES_VALUE (1) #define ASIC_FILTER_MAX_RES_VALUE (1)
#define MAX_SELECT_CHIP10_VAL (63) #define MAX_SELECT_CHIP10_VAL (63)
#define MAX_PHASE_SHIFTS (200) #define MAX_PHASE_SHIFTS (240)
#define BIT16_MASK (0xFFFF) #define BIT16_MASK (0xFFFF)
#define ADC_DECMT_QUARTER_SPEED (0x3) #define ADC_DECMT_QUARTER_SPEED (0x3)

View File

@ -483,8 +483,7 @@ void setupDetector() {
// hv // hv
DAC6571_SetDefines(HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME); DAC6571_SetDefines(HV_HARD_MAX_VOLTAGE, HV_DRIVER_FILE_NAME);
// dac // dac
LTC2620_D_SetDefines(DAC_MIN_MV, DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC, 1, LTC2620_D_SetDefines(DAC_MAX_MV, DAC_DRIVER_FILE_NAME, NDAC);
0, "");
resetCore(); resetCore();
resetPeripheral(); resetPeripheral();

View File

@ -34,7 +34,6 @@
#else #else
#define TEMPERATURE_FILE_NAME ("/sys/class/hwmon/hwmon0/temp1_input") #define TEMPERATURE_FILE_NAME ("/sys/class/hwmon/hwmon0/temp1_input")
#endif #endif
#define DAC_MIN_MV (0)
#define DAC_MAX_MV (2048) #define DAC_MAX_MV (2048)
#define TYPE_MYTHEN3_MODULE_VAL (93) #define TYPE_MYTHEN3_MODULE_VAL (93)
#define TYPE_TOLERANCE (5) #define TYPE_TOLERANCE (5)

View File

@ -4,11 +4,18 @@
#include <inttypes.h> #include <inttypes.h>
void LTC2620_D_SetDefines(int hardMinV, int hardMaxV, char *driverfname, /**
int numdacs, int numdevices, int startingDeviceIndex, * Set Defines
char *powerdownDriverfname); * @param hardMaxV maximum hardware limit
* @param driverfname driver file name
* @param numdacs number of dacs
*/
void LTC2620_D_SetDefines(int hardMaxV, char *driverfname, int numdacs);
/**
* Get max number of steps
*/
int LTC2620_D_GetMaxNumSteps(); int LTC2620_D_GetMaxNumSteps();
int LTC2620_D_GetPowerDownValue();
/** /**
* Convert voltage to dac units * Convert voltage to dac units

View File

@ -9,7 +9,4 @@ void bus_w(u_int32_t offset, u_int32_t data);
u_int32_t bus_r(u_int32_t offset); u_int32_t bus_r(u_int32_t offset);
uint64_t getU64BitReg(int aLSB, int aMSB); uint64_t getU64BitReg(int aLSB, int aMSB);
void setU64BitReg(uint64_t value, int aLSB, int aMSB); void setU64BitReg(uint64_t value, int aLSB, int aMSB);
u_int32_t readRegister(u_int32_t offset);
u_int32_t writeRegister(u_int32_t offset, u_int32_t data);
int mapCSP0(void); int mapCSP0(void);
u_int32_t *Arm_getUDPBaseAddress();

View File

@ -11,7 +11,7 @@ void initializePatternAddresses();
void initializePatternWord(); void initializePatternWord();
#endif #endif
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD) #if defined(CHIPTESTBOARDD) // TODO || defined(XILINX_CHIPTESTBOARDD)
uint64_t validate_readPatternIOControl(); uint64_t validate_readPatternIOControl();
int validate_writePatternIOControl(char *message, uint64_t arg); int validate_writePatternIOControl(char *message, uint64_t arg);
void writePatternIOControl(uint64_t word); void writePatternIOControl(uint64_t word);

View File

@ -1,12 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once
#include <sys/types.h>
int resetFPGA(char *mess);
int loadDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex);
int checksBeforeCreatingDeviceTree(char *mess);
int createDeviceTree(char *mess);
int verifyDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex);

View File

@ -27,7 +27,6 @@
#ifdef ARMPROCESSOR #ifdef ARMPROCESSOR
#include "arm64.h" #include "arm64.h"
#include "programViaArm.h"
#endif #endif
#ifdef MYTHEN3D #ifdef MYTHEN3D
@ -69,12 +68,8 @@ void basictests();
#if !defined(EIGERD) #if !defined(EIGERD)
int checkType(); int checkType();
int testFpga(); int testFpga();
#ifdef XILINX_CHIPTESTBOARDD
int testFixedFPGAPattern();
#else
int testBus(); int testBus();
#endif #endif
#endif
#if defined(GOTTHARDD) || \ #if defined(GOTTHARDD) || \
((defined(EIGERD) || defined(JUNGFRAUD) || defined(MOENCHD)) && \ ((defined(EIGERD) || defined(JUNGFRAUD) || defined(MOENCHD)) && \
@ -89,7 +84,9 @@ u_int64_t getFirmwareVersion();
#ifdef EIGERD #ifdef EIGERD
uint64_t getFrontEndFirmwareVersion(enum fpgaPosition fpgaPosition); uint64_t getFrontEndFirmwareVersion(enum fpgaPosition fpgaPosition);
#endif #endif
#ifndef XILINX_CHIPTESTBOARDD
u_int64_t getFirmwareAPIVersion(); u_int64_t getFirmwareAPIVersion();
#endif
void getHardwareVersion(char *version); void getHardwareVersion(char *version);
#ifdef EIGERD #ifdef EIGERD
int getHardwareVersionNumber(); int getHardwareVersionNumber();
@ -181,22 +178,6 @@ uint32_t readRegister16And32(uint32_t offset);
#endif #endif
// firmware functions (resets) // firmware functions (resets)
#if defined(XILINX_CHIPTESTBOARDD)
void cleanFifos();
void resetFlow();
int waitTranseiverReset(char *mess);
#ifdef VIRTUAL
void setTransceiverAlignment(int align);
#endif
int isTransceiverAligned();
int waitTransceiverAligned(char *mess);
int configureTransceiver(char *mess);
int isChipConfigured();
int powerChip(int on, char *mess);
int getPowerChip();
int configureChip(char *mess);
void startPeriphery();
#endif
#if defined(JUNGFRAUD) || defined(MOENCHD) || defined(CHIPTESTBOARDD) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(CHIPTESTBOARDD) || \
defined(MYTHEN3D) || defined(GOTTHARD2D) defined(MYTHEN3D) || defined(GOTTHARD2D)
void cleanFifos(); void cleanFifos();
@ -236,12 +217,6 @@ uint32_t getTransceiverEnableMask();
void setADCInvertRegister(uint32_t val); void setADCInvertRegister(uint32_t val);
uint32_t getADCInvertRegister(); uint32_t getADCInvertRegister();
#endif #endif
#ifdef XILINX_CHIPTESTBOARDD
void setADCEnableMask_10G(uint32_t mask);
uint32_t getADCEnableMask_10G();
int setTransceiverEnableMask(uint32_t mask);
uint32_t getTransceiverEnableMask();
#endif
#if defined(CHIPTESTBOARDD) #if defined(CHIPTESTBOARDD)
int setExternalSamplingSource(int val); int setExternalSamplingSource(int val);
int setExternalSampling(int val); int setExternalSampling(int val);
@ -257,7 +232,7 @@ int getParallelMode();
int setOverFlowMode(int mode); int setOverFlowMode(int mode);
int getOverFlowMode(); int getOverFlowMode();
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD) #ifdef CHIPTESTBOARDD
int setReadoutMode(enum readoutMode mode); int setReadoutMode(enum readoutMode mode);
int getReadoutMode(); int getReadoutMode();
#endif #endif
@ -268,7 +243,7 @@ int selectStoragecellStart(int pos);
int getMaxStoragecellStart(); int getMaxStoragecellStart();
#endif #endif
#if defined(JUNGFRAUD) || defined(MOENCHD) || defined(EIGERD) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(EIGERD) || \
defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD) defined(CHIPTESTBOARDD)
int setNextFrameNumber(uint64_t value); int setNextFrameNumber(uint64_t value);
int getNextFrameNumber(uint64_t *value); int getNextFrameNumber(uint64_t *value);
#endif #endif
@ -276,12 +251,14 @@ void setNumFrames(int64_t val);
int64_t getNumFrames(); int64_t getNumFrames();
void setNumTriggers(int64_t val); void setNumTriggers(int64_t val);
int64_t getNumTriggers(); int64_t getNumTriggers();
#ifndef XILINX_CHIPTESTBOARDD
#ifndef MYTHEN3D #ifndef MYTHEN3D
int setExpTime(int64_t val); int setExpTime(int64_t val);
int64_t getExpTime(); int64_t getExpTime();
#endif #endif
int setPeriod(int64_t val); int setPeriod(int64_t val);
int64_t getPeriod(); int64_t getPeriod();
#endif
#ifdef MYTHEN3D #ifdef MYTHEN3D
void setNumIntGates(int val); void setNumIntGates(int val);
void setNumGates(int val); void setNumGates(int val);
@ -313,9 +290,11 @@ int getNumAdditionalStorageCells();
int setStorageCellDelay(int64_t val); int setStorageCellDelay(int64_t val);
int64_t getStorageCellDelay(); int64_t getStorageCellDelay();
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD) #if defined(CHIPTESTBOARDD)
int setNumAnalogSamples(int val); int setNumAnalogSamples(int val);
int getNumAnalogSamples(); int getNumAnalogSamples();
#endif
#ifdef CHIPTESTBOARDD
int setNumDigitalSamples(int val); int setNumDigitalSamples(int val);
int getNumDigitalSamples(); int getNumDigitalSamples();
int setNumTransceiverSamples(int val); int setNumTransceiverSamples(int val);
@ -333,10 +312,10 @@ int64_t getNumFramesLeft();
int64_t getNumTriggersLeft(); int64_t getNumTriggersLeft();
#endif #endif
#if defined(JUNGFRAUD) || defined(MOENCHD) || defined(GOTTHARDD) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(GOTTHARDD) || \
defined(CHIPTESTBOARDD) || defined(MYTHEN3D) || defined(GOTTHARD2D) || \ defined(CHIPTESTBOARDD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
defined(XILINX_CHIPTESTBOARDD)
int setDelayAfterTrigger(int64_t val); int setDelayAfterTrigger(int64_t val);
int64_t getDelayAfterTrigger(); int64_t getDelayAfterTrigger();
int64_t getDelayAfterTriggerLeft(); int64_t getDelayAfterTriggerLeft();
int64_t getPeriodLeft(); int64_t getPeriodLeft();
#endif #endif
@ -347,7 +326,7 @@ int64_t getNumBurstsLeft();
int64_t getExpTimeLeft(); int64_t getExpTimeLeft();
#endif #endif
#if defined(JUNGFRAUD) || defined(MOENCHD) || defined(CHIPTESTBOARDD) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(CHIPTESTBOARDD) || \
defined(MYTHEN3D) || defined(GOTTHARD2D) || defined(XILINX_CHIPTESTBOARDD) defined(MYTHEN3D) || defined(GOTTHARD2D)
int64_t getFramesFromStart(); int64_t getFramesFromStart();
int64_t getActualTime(); int64_t getActualTime();
int64_t getMeasurementTime(); int64_t getMeasurementTime();
@ -400,11 +379,15 @@ void setDAC(enum DACINDEX ind, int val, int mV, int counterEnableCheck);
void setGeneralDAC(enum DACINDEX ind, int val, int mV); void setGeneralDAC(enum DACINDEX ind, int val, int mV);
void setVthDac(int index, int enable); void setVthDac(int index, int enable);
#else #else
#ifndef XILINX_CHIPTESTBOARDD
void setDAC(enum DACINDEX ind, int val, int mV); void setDAC(enum DACINDEX ind, int val, int mV);
#endif #endif
#endif
#ifndef XILINX_CHIPTESTBOARDD
int getDAC(enum DACINDEX ind, int mV); int getDAC(enum DACINDEX ind, int mV);
int getMaxDacSteps(); int getMaxDacSteps();
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD) #endif
#if defined(CHIPTESTBOARDD)
int dacToVoltage(int dac); int dacToVoltage(int dac);
int checkVLimitCompliant(int mV); int checkVLimitCompliant(int mV);
int checkVLimitDacCompliant(int dac); int checkVLimitDacCompliant(int dac);
@ -423,24 +406,20 @@ int isPowerValid(enum DACINDEX ind, int val);
int getPower(); int getPower();
void setPower(enum DACINDEX ind, int val); void setPower(enum DACINDEX ind, int val);
void powerOff(); void powerOff();
#elif XILINX_CHIPTESTBOARDD
int getPower();
void setPower(enum DACINDEX ind, int val);
#endif #endif
#if defined(MYTHEN3D) || defined(GOTTHARD2D) || defined(XILINX_CHIPTESTBOARDD) #if defined(MYTHEN3D) || defined(GOTTHARD2D)
int getADC(enum ADCINDEX ind, int *value); int getADC(enum ADCINDEX ind, int *value);
#else #else
#ifndef XILINX_CHIPTESTBOARDD
int getADC(enum ADCINDEX ind); int getADC(enum ADCINDEX ind);
#endif #endif
#endif
#ifdef CHIPTESTBOARDD #ifdef CHIPTESTBOARDD
int getSlowADC(int ichan); int getSlowADC(int ichan);
int getSlowADCTemperature(); int getSlowADCTemperature();
#endif #endif
#ifdef XILINX_CHIPTESTBOARDD #ifndef XILINX_CHIPTESTBOARDD
int getSlowADC(int ichan, int *retval);
int getTemperature(int *retval);
#else
int setHighVoltage(int val); int setHighVoltage(int val);
#endif #endif
@ -512,8 +491,7 @@ void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip,
uint32_t sourceip, uint16_t sourceport); uint32_t sourceip, uint16_t sourceport);
#endif #endif
#if defined(JUNGFRAUD) || defined(MOENCHD) || defined(GOTTHARD2D) || \ #if defined(JUNGFRAUD) || defined(MOENCHD) || defined(GOTTHARD2D) || \
defined(MYTHEN3D) || defined(CHIPTESTBOARDD) || \ defined(MYTHEN3D) || defined(CHIPTESTBOARDD)
defined(XILINX_CHIPTESTBOARDD)
void calcChecksum(udp_header *udp); void calcChecksum(udp_header *udp);
#endif #endif
#ifdef GOTTHARDD #ifdef GOTTHARDD
@ -716,27 +694,30 @@ int setTransmissionDelayRight(int value);
#endif #endif
// aquisition // aquisition
#ifndef XILINX_CHIPTESTBOARDD
int startStateMachine(); int startStateMachine();
#ifdef VIRTUAL #ifdef VIRTUAL
void *start_timer(void *arg); void *start_timer(void *arg);
#endif #endif
int stopStateMachine(); int stopStateMachine();
#if defined(MYTHEN3D) || defined(XILINX_CHIPTESTBOARDD) #endif
#ifdef MYTHEN3D
int softwareTrigger(); int softwareTrigger();
#endif #endif
#if defined(EIGERD) || defined(JUNGFRAUD) || defined(MOENCHD) #if defined(EIGERD) || defined(JUNGFRAUD) || defined(MOENCHD)
int softwareTrigger(int block); int softwareTrigger(int block);
#endif #endif
#if defined(EIGERD) || defined(MYTHEN3D) || defined(CHIPTESTBOARDD) || \ #if defined(EIGERD) || defined(MYTHEN3D) || defined(CHIPTESTBOARDD)
defined(XILINX_CHIPTESTBOARDD)
int startReadOut(); int startReadOut();
#endif #endif
enum runStatus getRunStatus(); enum runStatus getRunStatus();
#ifdef EIGERD #ifdef EIGERD
void waitForAcquisitionEnd(int *ret, char *mess); void waitForAcquisitionEnd(int *ret, char *mess);
#else #else
#ifndef XILINX_CHIPTESTBOARDD
void waitForAcquisitionEnd(); void waitForAcquisitionEnd();
#endif #endif
#endif
#if defined(CHIPTESTBOARDD) #if defined(CHIPTESTBOARDD)
int validateUDPSocket(); int validateUDPSocket();
void readandSendUDPFrames(); void readandSendUDPFrames();
@ -748,8 +729,7 @@ int readFrameFromFifo();
#endif #endif
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MOENCHD) || \ #if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MOENCHD) || \
defined(CHIPTESTBOARDD) || defined(MYTHEN3D) || defined(GOTTHARD2D) || \ defined(CHIPTESTBOARDD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
defined(XILINX_CHIPTESTBOARDD)
u_int32_t runBusy(); u_int32_t runBusy();
#endif #endif
@ -758,11 +738,15 @@ u_int32_t runState(enum TLogLevel lev);
#endif #endif
// common // common
#ifndef XILINX_CHIPTESTBOARDD
int calculateDataBytes(); int calculateDataBytes();
int getTotalNumberOfChannels(); int getTotalNumberOfChannels();
#endif
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD) #if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD)
void getNumberOfChannels(int *nchanx, int *nchany); void getNumberOfChannels(int *nchanx, int *nchany);
#endif #endif
#ifndef XILINX_CHIPTESTBOARDD
int getNumberOfChips(); int getNumberOfChips();
int getNumberOfDACs(); int getNumberOfDACs();
int getNumberOfChannelsPerChip(); int getNumberOfChannelsPerChip();
#endif

View File

@ -329,4 +329,3 @@ int getColumn();
int setColumn(int); int setColumn(int);
int get_pedestal_mode(int); int get_pedestal_mode(int);
int set_pedestal_mode(int); int set_pedestal_mode(int);
int config_transceiver(int);

View File

@ -13,54 +13,35 @@
#define LTC2620_D_MAX_STEPS (LTC2620_D_MAX_DAC_VAL + 1) #define LTC2620_D_MAX_STEPS (LTC2620_D_MAX_DAC_VAL + 1)
// defines from the fpga // defines from the fpga
int LTC2620_D_HardMinVoltage = 0;
int LTC2620_D_HardMaxVoltage = 0; int LTC2620_D_HardMaxVoltage = 0;
char LTC2620_D_DriverFileName[MAX_STR_LENGTH]; char LTC2620_D_DriverFileName[MAX_STR_LENGTH];
char LTC2620_D_PowerDownDriverFileName[MAX_STR_LENGTH];
int LTC2620_D_NumDacs = 0; int LTC2620_D_NumDacs = 0;
int LTC2620_D_NumDevices = 0;
int LTC2620_D_NumChannelsPerDevice = 0;
int LTC2620_D_DacDriverStartingDeviceIndex = 0;
void LTC2620_D_SetDefines(int hardMinV, int hardMaxV, char *driverfname, void LTC2620_D_SetDefines(int hardMaxV, char *driverfname, int numdacs) {
int numdacs, int numdevices, int startingDeviceIndex,
char *powerdownDriverfname) {
LOG(logINFOBLUE, LOG(logINFOBLUE,
("Configuring DACs (LTC2620) to %s\n\t (numdacs:%d, hard min:%d, hard " ("Configuring DACs (LTC2620) to %s (numdacs:%d, hard max: %dmV)\n",
"max: %dmV, idev:%d)\n", driverfname, numdacs, hardMaxV));
driverfname, numdacs, hardMinV, hardMaxV, startingDeviceIndex));
LTC2620_D_HardMinVoltage = hardMinV;
LTC2620_D_HardMaxVoltage = hardMaxV; LTC2620_D_HardMaxVoltage = hardMaxV;
memset(LTC2620_D_DriverFileName, 0, MAX_STR_LENGTH); memset(LTC2620_D_DriverFileName, 0, MAX_STR_LENGTH);
strcpy(LTC2620_D_DriverFileName, driverfname); strcpy(LTC2620_D_DriverFileName, driverfname);
memset(LTC2620_D_PowerDownDriverFileName, 0, MAX_STR_LENGTH);
strcpy(LTC2620_D_PowerDownDriverFileName, powerdownDriverfname);
LTC2620_D_NumDacs = numdacs; LTC2620_D_NumDacs = numdacs;
LTC2620_D_NumDevices = numdevices;
LTC2620_D_NumChannelsPerDevice = LTC2620_D_NumDacs / LTC2620_D_NumDevices;
LTC2620_D_DacDriverStartingDeviceIndex = startingDeviceIndex;
} }
int LTC2620_D_GetMaxNumSteps() { return LTC2620_D_MAX_STEPS; } int LTC2620_D_GetMaxNumSteps() { return LTC2620_D_MAX_STEPS; }
int LTC2620_D_GetPowerDownValue() { return LTC2620_D_PWR_DOWN_VAL; }
int LTC2620_D_VoltageToDac(int voltage, int *dacval) { int LTC2620_D_VoltageToDac(int voltage, int *dacval) {
return ConvertToDifferentRange(LTC2620_D_HardMinVoltage, return ConvertToDifferentRange(0, LTC2620_D_HardMaxVoltage, 0,
LTC2620_D_HardMaxVoltage, 0,
LTC2620_D_MAX_DAC_VAL, voltage, dacval); LTC2620_D_MAX_DAC_VAL, voltage, dacval);
} }
int LTC2620_D_DacToVoltage(int dacval, int *voltage) { int LTC2620_D_DacToVoltage(int dacval, int *voltage) {
return ConvertToDifferentRange(0, LTC2620_D_MAX_DAC_VAL, return ConvertToDifferentRange(0, LTC2620_D_MAX_DAC_VAL, 0,
LTC2620_D_HardMinVoltage,
LTC2620_D_HardMaxVoltage, dacval, voltage); LTC2620_D_HardMaxVoltage, dacval, voltage);
} }
int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname, int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname,
int *dacval) { int *dacval) {
LOG(logDEBUG1, ("dacnum:%d, val:%d, ismV:%d\n", dacnum, val, mV)); LOG(logDEBUG1, ("dacnum:%d, val:%d, ismV:%d\n", dacnum, val, mV));
// validate index // validate index
if (dacnum < 0 || dacnum >= LTC2620_D_NumDacs) { if (dacnum < 0 || dacnum >= LTC2620_D_NumDacs) {
LOG(logERROR, ("Dac index %d is out of bounds (0 to %d)\n", dacnum, LOG(logERROR, ("Dac index %d is out of bounds (0 to %d)\n", dacnum,
@ -68,30 +49,14 @@ int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname,
return FAIL; return FAIL;
} }
// validate set // get
if (val < 0 && val != LTC2620_D_PWR_DOWN_VAL) if (val < 0 && val != LTC2620_D_PWR_DOWN_VAL)
return FAIL; return FAIL;
int ret = OK;
*dacval = val;
#ifndef VIRTUAL
char fnameFormat[MAX_STR_LENGTH];
memset(fnameFormat, 0, MAX_STR_LENGTH);
strcpy(fnameFormat, LTC2620_D_DriverFileName);
#endif
// power down dac (different file name)
if (val == LTC2620_D_PWR_DOWN_VAL) {
#if defined(XILINX_CHIPTESTBOARDD) && !defined(VIRTUAL)
LOG(logINFO, ("Powering down DAC %2d [%-6s] \n", dacnum, dacname));
strcpy(fnameFormat, LTC2620_D_PowerDownDriverFileName);
#endif
}
// proper value to set
else {
// convert to dac or get mV value // convert to dac or get mV value
*dacval = val;
int dacmV = val; int dacmV = val;
int ret = OK;
if (mV) { if (mV) {
ret = LTC2620_D_VoltageToDac(val, dacval); ret = LTC2620_D_VoltageToDac(val, dacval);
} else if (val >= 0) { } else if (val >= 0) {
@ -106,32 +71,18 @@ int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname,
return FAIL; return FAIL;
} }
// print and set // set
#ifdef XILINX_CHIPTESTBOARDD
if (*dacval >= 0) {
LOG(logINFO, ("Setting DAC %2d [%-6s] : %d dac (%d mV)\n", dacnum,
dacname, *dacval, dacmV));
}
#else
if ((*dacval >= 0) || (*dacval == LTC2620_D_PWR_DOWN_VAL)) { if ((*dacval >= 0) || (*dacval == LTC2620_D_PWR_DOWN_VAL)) {
LOG(logINFO, ("Setting DAC %2d [%-12s] : %d dac (%d mV)\n", dacnum, LOG(logINFO, ("Setting DAC %2d [%-12s] : %d dac (%d mV)\n", dacnum,
dacname, *dacval, dacmV)); dacname, *dacval, dacmV));
}
#endif
}
// set in file
#ifndef VIRTUAL #ifndef VIRTUAL
char fname[MAX_STR_LENGTH]; char fname[MAX_STR_LENGTH];
memset(fname, 0, MAX_STR_LENGTH); strcpy(fname, LTC2620_D_DriverFileName);
#ifdef XILINX_CHIPTESTBOARDD char temp[20];
int idev = LTC2620_D_DacDriverStartingDeviceIndex + memset(temp, 0, sizeof(temp));
(dacnum / LTC2620_D_NumChannelsPerDevice); sprintf(temp, "%d", dacnum);
int idac = dacnum % LTC2620_D_NumChannelsPerDevice; strcat(fname, temp);
sprintf(fname, fnameFormat, idev, idac);
#else
sprintf(fname, "%s%d", fnameFormat, dacnum);
#endif
LOG(logDEBUG1, ("fname %s\n", fname)); LOG(logDEBUG1, ("fname %s\n", fname));
// open file // open file
@ -142,16 +93,9 @@ int LTC2620_D_SetDACValue(int dacnum, int val, int mV, char *dacname,
return FAIL; return FAIL;
} }
// convert to string, add 0 and write to file // convert to string, add 0 and write to file
#ifdef XILINX_CHIPTESTBOARDD
// not changing *dacval from -100 (cant write -100 to file: invalid arg)
int writeValue = *dacval;
if (writeValue == LTC2620_D_PWR_DOWN_VAL)
writeValue = 1;
fprintf(fd, "%d\n", writeValue);
#else
fprintf(fd, "%d\n", *dacval); fprintf(fd, "%d\n", *dacval);
#endif
fclose(fd); fclose(fd);
#endif #endif
}
return OK; return OK;
} }

View File

@ -11,13 +11,10 @@
#include <sys/mman.h> // mmap #include <sys/mman.h> // mmap
/* global variables */ /* global variables */
#define CSP0 (0xB0080000) #define CSP0 (0xB0010000)
#define CSP1 (0xB0050000) // udp #define MEM_SIZE 0x100000
#define MEM_SIZE (0x10000)
//#define MEM_SIZE_CSP0 (4096)
//#define MEM_SIZE_CSP1 (2 * 4096)
u_int32_t *csp0base = 0; u_int32_t *csp0base = 0;
u_int32_t *csp1base = 0;
void bus_w(u_int32_t offset, u_int32_t data) { void bus_w(u_int32_t offset, u_int32_t data) {
volatile u_int32_t *ptr1; volatile u_int32_t *ptr1;
@ -42,53 +39,35 @@ void setU64BitReg(uint64_t value, int aLSB, int aMSB) {
bus_w(aMSB, (value >> 32) & (0xffffffff)); bus_w(aMSB, (value >> 32) & (0xffffffff));
} }
u_int32_t readRegister(u_int32_t offset) { return bus_r(offset); }
u_int32_t writeRegister(u_int32_t offset, u_int32_t data) {
bus_w(offset, data);
return readRegister(offset);
}
int mapCSP0(void) { int mapCSP0(void) {
u_int32_t csps[2] = {CSP0, CSP1};
u_int32_t **cspbases[2] = {&csp0base, &csp1base};
char names[2][10] = {"csp0base", "csp1base"};
for (int i = 0; i < 2; ++i) {
// if not mapped // if not mapped
if (*cspbases[i] == 0) { if (csp0base == 0) {
LOG(logINFO, ("Mapping memory for %s\n", names[i])); LOG(logINFO, ("Mapping memory\n"));
#ifdef VIRTUAL #ifdef VIRTUAL
*cspbases[i] = malloc(MEM_SIZE); csp0base = malloc(MEM_SIZE);
if (*cspbases[i] == NULL) { if (csp0base == NULL) {
LOG(logERROR, LOG(logERROR, ("Could not allocate virtual memory.\n"));
("Could not allocate virtual memory for %s.\n", names[i]));
return FAIL; return FAIL;
} }
LOG(logINFO, ("memory allocated for %s\n", names[i])); LOG(logINFO, ("memory allocated\n"));
#else #else
int fd = open("/dev/mem", O_RDWR | O_SYNC, 0); int fd;
fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
if (fd == -1) { if (fd == -1) {
LOG(logERROR, ("Can't find /dev/mem for %s\n", names[i])); LOG(logERROR, ("Can't find /dev/mem\n"));
return FAIL; return FAIL;
} }
LOG(logDEBUG1, LOG(logDEBUG1, ("/dev/mem opened\n"));
("/dev/mem opened for %s, (CSP:0x%x)\n", names[i], csps[i])); csp0base = (u_int32_t *)mmap(0, MEM_SIZE, PROT_READ | PROT_WRITE,
*cspbases[i] = MAP_FILE | MAP_SHARED, fd, CSP0);
(u_int32_t *)mmap(0, MEM_SIZE, PROT_READ | PROT_WRITE, if (csp0base == MAP_FAILED) {
MAP_FILE | MAP_SHARED, fd, csps[i]); LOG(logERROR, ("Can't map memmory area\n"));
if (*cspbases[i] == MAP_FAILED) {
LOG(logERROR, ("Can't map memmory area for %s\n", names[i]));
return FAIL; return FAIL;
} }
#endif #endif
LOG(logINFO, ("%s mapped from %p to %p,(CSP:0x%x) \n", names[i], LOG(logINFO, ("csp0base mapped from %p to %p\n", csp0base,
*cspbases[i], *cspbases[i] + MEM_SIZE, csps[i])); (csp0base + MEM_SIZE)));
// LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
} else } else
LOG(logINFO, ("Memory %s already mapped before\n", names[i])); LOG(logINFO, ("Memory already mapped before\n"));
}
return OK; return OK;
} }
u_int32_t *Arm_getUDPBaseAddress() { return csp1base; }

View File

@ -114,11 +114,10 @@ int getTimeFromString(char *buf, time_t *result) {
t.tm_mday, t.tm_mon, t.tm_year + 1900, t.tm_hour, t.tm_min, t.tm_sec)); t.tm_mday, t.tm_mon, t.tm_year + 1900, t.tm_hour, t.tm_min, t.tm_sec));
*result = mktime(&t); *result = mktime(&t);
/* Do not check as it fails with nios if (*result == -1) {
if (*result == (time_t)-1) {
LOG(logERROR, ("Could not convert time structure to time_t\n")); LOG(logERROR, ("Could not convert time structure to time_t\n"));
return FAIL; return FAIL;
}*/ }
return OK; return OK;
} }
@ -752,17 +751,13 @@ int readADCFromFile(char *fname, int *value) {
*value = -1; *value = -1;
if (sscanf(line, "%d", value) != 1) { if (sscanf(line, "%d", value) != 1) {
#ifdef XILINX_CHIPTESTBOARDD
LOG(logERROR, ("Could not scan adc from %s\n", line));
#else
LOG(logERROR, ("Could not scan temperature from %s\n", line)); LOG(logERROR, ("Could not scan temperature from %s\n", line));
#endif
return FAIL; return FAIL;
} }
#ifdef EIGERD #ifdef EIGERD
*value /= 10; *value /= 10;
#elif !defined(XILINX_CHIPTESTBOARDD) #else
LOG(logINFO, ("Temperature: %.2f °C\n", (double)(*value) / 1000.00)); LOG(logINFO, ("Temperature: %.2f °C\n", (double)(*value) / 1000.00));
#endif #endif

View File

@ -52,26 +52,12 @@ void initializePatternWord() {
#endif #endif
#endif #endif
#if defined(CHIPTESTBOARDD) || defined(XILINX_CHIPTESTBOARDD) #if defined(CHIPTESTBOARDD) // TODO || defined(XILINX_CHIPTESTBOARDD)
uint64_t validate_readPatternIOControl() { uint64_t validate_readPatternIOControl() {
#if defined(CHIPTESTBOARDD)
return getU64BitReg(PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG); return getU64BitReg(PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
#elif defined(XILINX_CHIPTESTBOARDD)
return (uint64_t)(bus_r(PINIOCTRLREG));
#endif
} }
int validate_writePatternIOControl(char *message, uint64_t arg) { int validate_writePatternIOControl(char *message, uint64_t arg) {
// validate input
#ifdef XILINX_CHIPTESTBOARDD
if (arg > BIT32_MSK) {
strcpy(message, "Could not set pattern IO Control. Must be 32 bit for "
"this detector\n");
LOG(logERROR, (message));
return FAIL;
}
#endif
writePatternIOControl(arg); writePatternIOControl(arg);
// validate result // validate result
@ -91,15 +77,9 @@ int validate_writePatternIOControl(char *message, uint64_t arg) {
} }
void writePatternIOControl(uint64_t word) { void writePatternIOControl(uint64_t word) {
#ifdef CHIPTESTBOARDD
LOG(logINFO, LOG(logINFO,
("Setting Pattern I/O Control: 0x%llx\n", (long long int)word)); ("Setting Pattern I/O Control: 0x%llx\n", (long long int)word));
setU64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG); setU64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
#elif defined(XILINX_CHIPTESTBOARDD)
uint32_t val = (uint32_t)word;
LOG(logINFO, ("Setting Pattern I/O Control: 0x%x\n", val));
bus_w(PINIOCTRLREG, val);
#endif
} }
#endif #endif

View File

@ -1,196 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "programViaArm.h"
#include "clogger.h"
#include "sls/sls_detector_defs.h"
#include <string.h> //memset
#include <unistd.h> // access
#define CMD_ARM_LOAD_BIT_FILE \
"~/fpgautil/fpgautil -b /root/apps/xilinx-ctb/XilinxCTB.bit -f Full"
#define CMD_ARM_DEVICE_TREE_API_FOLDER \
"/sys/kernel/config/device-tree/overlays/spidr"
#define CMD_ARM_DEVICE_TREE_OVERLAY_FILE "/root/apps/xilinx-ctb/pl.dtbo"
#define CMD_ARM_LOAD_DEVICE_TREE_FORMAT "cat %s > %s/dtbo"
#define CMD_ARM_DEVICE_TREE_DST "/sys/bus/iio/devices/iio:device"
#define CMD_ARM_DEVICE_NAME "xilinx-ams", "ad7689", "dac@0", "dac@1", "dac@2"
#define TIME_LOAD_DEVICE_TREE_MS (500)
extern int executeCommand(char *command, char *result, enum TLogLevel level);
int resetFPGA(char *mess) {
LOG(logINFOBLUE, ("Reseting FPGA...\n"));
#ifndef VIRTUAL
char retvals[MAX_STR_LENGTH] = {0};
if (executeCommand(CMD_ARM_LOAD_BIT_FILE, retvals, logDEBUG1) == FAIL) {
snprintf(mess, MAX_STR_LENGTH,
"Could not reset fpga. Command to load bit file failed (%s)\n",
retvals);
LOG(logERROR, (mess));
return FAIL;
}
#endif
LOG(logINFOBLUE, ("FPGA reset successfully\n"))
return OK;
}
int loadDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex) {
if (verifyDeviceTree(mess, adcDeviceIndex, dacDeviceIndex) == OK)
return OK;
if (checksBeforeCreatingDeviceTree(mess) == FAIL)
return FAIL;
if (createDeviceTree(mess) == FAIL)
return FAIL;
if (verifyDeviceTree(mess, adcDeviceIndex, dacDeviceIndex) == FAIL) {
LOG(logERROR, ("Device tree loading failed at verification\n"));
return FAIL;
}
LOG(logINFOBLUE, ("Device tree loaded successfully\n"))
return OK;
}
int checksBeforeCreatingDeviceTree(char *mess) {
// check if device tree overlay file exists
if (access(CMD_ARM_DEVICE_TREE_OVERLAY_FILE, F_OK) != 0) {
snprintf(mess, MAX_STR_LENGTH,
"Device tree overlay file (%s) does not exist\n",
CMD_ARM_DEVICE_TREE_OVERLAY_FILE);
LOG(logERROR, (mess));
return FAIL;
}
LOG(logINFO, ("\tDevice tree overlay file exists (%s)\n",
CMD_ARM_DEVICE_TREE_OVERLAY_FILE));
// check if device tree folder exists. If it does, remove it
if (access(CMD_ARM_DEVICE_TREE_API_FOLDER, F_OK) == 0) {
// remove it
char cmd[MAX_STR_LENGTH] = {0};
memset(cmd, 0, MAX_STR_LENGTH);
sprintf(cmd, "rmdir %s", CMD_ARM_DEVICE_TREE_API_FOLDER);
char retvals[MAX_STR_LENGTH] = {0};
memset(retvals, 0, MAX_STR_LENGTH);
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
snprintf(mess, MAX_STR_LENGTH,
"Could not unload device tree overlay api with %s (%s)\n",
cmd, retvals);
LOG(logWARNING, (mess));
return FAIL;
}
LOG(logINFO, ("\tUnloaded existing device tree overlay api (%s)\n",
CMD_ARM_DEVICE_TREE_API_FOLDER));
} else {
LOG(logINFO, ("\tNo existing device tree overlay api found(%s)\n",
CMD_ARM_DEVICE_TREE_API_FOLDER));
}
// create device tree overlay folder
{
char cmd[MAX_STR_LENGTH] = {0};
memset(cmd, 0, MAX_STR_LENGTH);
sprintf(cmd, "mkdir %s", CMD_ARM_DEVICE_TREE_API_FOLDER);
char retvals[MAX_STR_LENGTH] = {0};
memset(retvals, 0, MAX_STR_LENGTH);
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
snprintf(mess, MAX_STR_LENGTH,
"Could not create device tree overlay api with %s (%s)\n",
cmd, retvals);
LOG(logWARNING, (mess));
return FAIL;
}
LOG(logINFO, ("\tDevice tree overlay api created (%s)\n",
CMD_ARM_DEVICE_TREE_API_FOLDER));
}
return OK;
}
int createDeviceTree(char *mess) {
char cmd[MAX_STR_LENGTH] = {0};
memset(cmd, 0, MAX_STR_LENGTH);
sprintf(cmd, CMD_ARM_LOAD_DEVICE_TREE_FORMAT,
CMD_ARM_DEVICE_TREE_OVERLAY_FILE, CMD_ARM_DEVICE_TREE_API_FOLDER);
char retvals[MAX_STR_LENGTH] = {0};
memset(retvals, 0, MAX_STR_LENGTH);
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
snprintf(mess, MAX_STR_LENGTH,
"Could not load device tree overlay with %s (%s)\n", cmd,
retvals);
LOG(logWARNING, (mess));
return FAIL;
}
LOG(logINFO, ("\tDevice tree overlay created (cmd: %s)\n", cmd));
usleep(TIME_LOAD_DEVICE_TREE_MS * 1000);
return OK;
}
int verifyDeviceTree(char *mess, int *adcDeviceIndex, int *dacDeviceIndex) {
LOG(logINFOBLUE, ("Verifying Device Tree...\n"));
*adcDeviceIndex = 1;
*dacDeviceIndex = 2;
#ifndef VIRTUAL
// check if iio:device0-4 exists in device tree destination
int hardcodedDeviceIndex = 0;
for (int i = 0; i != 5; ++i) {
char deviceName[MAX_STR_LENGTH] = {0};
memset(deviceName, 0, MAX_STR_LENGTH);
sprintf(deviceName, "%s%d/name", CMD_ARM_DEVICE_TREE_DST, i);
// check if device exist
if (access(deviceName, F_OK) != 0) {
snprintf(mess, MAX_STR_LENGTH,
"Could not verify device tree. Device %s does not exist\n",
deviceName);
LOG(logWARNING, (mess));
return FAIL;
}
// find name
char cmd[MAX_STR_LENGTH] = {0};
memset(cmd, 0, MAX_STR_LENGTH);
sprintf(cmd, "cat %s", deviceName);
char retvals[MAX_STR_LENGTH] = {0};
memset(retvals, 0, MAX_STR_LENGTH);
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
snprintf(mess, MAX_STR_LENGTH,
"Could not retrieve device name from device %s (%s)\n",
deviceName, retvals);
LOG(logWARNING, (mess));
return FAIL;
}
// verify name
char *deviceNames[] = {CMD_ARM_DEVICE_NAME};
if (strstr(retvals, deviceNames[hardcodedDeviceIndex]) == NULL) {
// dacs got loaded first
if (i == 1 &&
strstr(retvals, deviceNames[hardcodedDeviceIndex + 1]) !=
NULL) {
++hardcodedDeviceIndex;
*adcDeviceIndex = 4;
*dacDeviceIndex = 1;
} else {
snprintf(
mess, MAX_STR_LENGTH,
"Could not verify device tree. Device %s expected %s but "
"got %s\n",
deviceName, deviceNames[i], retvals);
LOG(logWARNING, (mess));
return FAIL;
}
}
++hardcodedDeviceIndex;
// in case dacs were loaded first
if (hardcodedDeviceIndex == 5)
hardcodedDeviceIndex = 1;
}
#endif
LOG(logINFOBLUE, ("Device tree verified successfully [temp: 0, adc:%d, "
"dac:%d, %d, %d]\n",
*adcDeviceIndex, *dacDeviceIndex, *dacDeviceIndex + 1,
*dacDeviceIndex + 2));
return OK;
}

View File

@ -79,7 +79,7 @@ int main(int argc, char *argv[]) {
"\t-v, --version : Software version\n" "\t-v, --version : Software version\n"
"\t-p, --port <port> : TCP communication port with client. " "\t-p, --port <port> : TCP communication port with client. "
"\n" "\n"
"\t-g, --nomodule : [Mythen3][Gotthard2][Xilinx Ctb] \n" "\t-g, --nomodule : [Mythen3][Gotthard2] \n"
"\t Generic or No Module mode. Skips " "\t Generic or No Module mode. Skips "
"detector type checks. \n" "detector type checks. \n"
"\t-f, --phaseshift <value> : [Gotthard] only. Sets phase shift. \n" "\t-f, --phaseshift <value> : [Gotthard] only. Sets phase shift. \n"

View File

@ -9,10 +9,7 @@ add_executable(xilinx_ctbDetectorServer_virtual
../slsDetectorServer/src/common.c ../slsDetectorServer/src/common.c
../slsDetectorServer/src/sharedMemory.c ../slsDetectorServer/src/sharedMemory.c
../slsDetectorServer/src/loadPattern.c ../slsDetectorServer/src/loadPattern.c
../slsDetectorServer/src/programViaArm.c
../slsDetectorServer/src/communication_funcs_UDP.c
../../slsSupportLib/src/md5.c ../../slsSupportLib/src/md5.c
../slsDetectorServer/src/LTC2620_Driver.c
) )
include_directories( include_directories(
@ -30,7 +27,7 @@ target_compile_definitions(xilinx_ctbDetectorServer_virtual
) )
target_link_libraries(xilinx_ctbDetectorServer_virtual target_link_libraries(xilinx_ctbDetectorServer_virtual
PUBLIC pthread rt m slsProjectCSettings PUBLIC pthread rt slsProjectCSettings
) )
set_target_properties(xilinx_ctbDetectorServer_virtual PROPERTIES set_target_properties(xilinx_ctbDetectorServer_virtual PROPERTIES

View File

@ -18,7 +18,7 @@ DESTDIR ?= bin
INSTMODE = 0777 INSTMODE = 0777
SRCS = slsDetectorFunctionList.c SRCS = slsDetectorFunctionList.c
SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)arm64.c $(main_src)common.c $(main_src)/sharedMemory.c $(main_src)/loadPattern.c $(md5_dir)md5.c $(main_src)programViaArm.c $(main_src)LTC2620_Driver.c SRCS += $(main_src)slsDetectorServer.c $(main_src)slsDetectorServer_funcs.c $(main_src)communication_funcs.c $(main_src)arm64.c $(main_src)common.c $(main_src)/sharedMemory.c $(main_src)/loadPattern.c $(md5_dir)md5.c
OBJS = $(SRCS:.c=.o) OBJS = $(SRCS:.c=.o)

View File

@ -2,48 +2,28 @@
// Copyright (C) 2021 Contributors to the SLS Detector Package // Copyright (C) 2021 Contributors to the SLS Detector Package
#pragma once #pragma once
#define CTRL_REG (0x0) #define CTRLREG1 (0x0)
#define POWER_VIO_OFST (0) #define CTRLREG2 (0x4)
#define POWER_VIO_MSK (0x00000001 << POWER_VIO_OFST)
#define POWER_VCC_A_OFST (1)
#define POWER_VCC_A_MSK (0x00000001 << POWER_VCC_A_OFST)
#define POWER_VCC_B_OFST (2)
#define POWER_VCC_B_MSK (0x00000001 << POWER_VCC_B_OFST)
#define POWER_VCC_C_OFST (3)
#define POWER_VCC_C_MSK (0x00000001 << POWER_VCC_C_OFST)
#define POWER_VCC_D_OFST (4)
#define POWER_VCC_D_MSK (0x00000001 << POWER_VCC_D_OFST)
#define EMPTY4REG (0x4)
#define STATUSREG1 (0x8) #define STATUSREG1 (0x8)
#define TRANSMISSIONBUSY_OFST (0)
#define TRANSMISSIONBUSY_MSK (0x00000001 << TRANSMISSIONBUSY_OFST)
#define STATUSREG2 (0xC) #define STATUSREG2 (0xC)
#define FPGAVERSIONREG (0x10) #define FPGAVERSIONREG (0x10)
#define FPGACOMPDATE_OFST (0) #define COMPDATE_OFST (0)
#define FPGACOMPDATE_MSK (0x00ffffff << FPGACOMPDATE_OFST) #define COMPDATE_MSK (0x00ffffff << COMPDATE_OFST)
#define FPGADETTYPE_OFST (24) #define DETTYPE_OFST (24)
#define FPGADETTYPE_MSK (0x000000ff << FPGADETTYPE_OFST) #define DETTYPE_MSK (0x000000ff << DETTYPE_OFST)
#define EMPTY14REG (0x14) #define EMPTY14REG (0x14)
#define FIXEDPATTERNREG (0x18) #define EMPTY18REG (0x18)
#define FIXEDPATTERNVAL (0xACDC2016)
#define EMPTY1CREG (0x1C) #define EMPTY1CREG (0x1C)
#define APIVERSIONREG (0x20) #define EMPTY20REG (0x20)
#define APICOMPDATE_OFST (0)
#define APICOMPDATE_MSK (0x00ffffff << APICOMPDATE_OFST)
#define APIDETTYPE_OFST (24)
#define APIDETTYPE_MSK (0x000000ff << APIDETTYPE_OFST)
#define EMPTY24REG (0x24) #define EMPTY24REG (0x24)
@ -132,75 +112,75 @@
#define EMPTY9CREG (0x9C) #define EMPTY9CREG (0x9C)
#define FLOW_STATUS_REG (0x100) #define FLOWSTATUSREG (0x100)
#define RSM_BUSY_OFST (0) #define RSMBUSY_OFST (0)
#define RSM_BUSY_MSK (0x00000001 << RSM_BUSY_OFST) #define RSMBUSY_MSK (0x00000001 << RSMBUSY_OFST)
#define RSM_TRG_WAIT_OFST (3) #define RSMTRGWAIT_OFST (3)
#define RSM_TRG_WAIT_MSK (0x00000001 << RSM_TRG_WAIT_OFST) #define RSMTRGWAIT_MSK (0x00000001 << RSMTRGWAIT_OFST)
#define CSM_BUSY_OFST (17) #define CSMBUSY_OFST (17)
#define CSM_BUSY_MSK (0x00000001 << CSM_BUSY_OFST) #define CSMBUSY_MSK (0x00000001 << CSMBUSY_OFST)
#define EMPTY104REG (0x104) #define EMPTY104REG (0x104)
#define FLOW_CONTROL_REG (0x108) #define FLOWCONTROLREG (0x108)
#define START_F_OFST (0) #define STARTF_OFST (0)
#define START_F_MSK (0x00000001 << START_F_OFST) #define STARTF_MSK (0x00000001 << STARTF_OFST)
#define STOP_F_OFST (1) #define STOPF_OFST (1)
#define STOP_F_MSK (0x00000001 << STOP_F_OFST) #define STOPF_MSK (0x00000001 << STOPF_OFST)
#define RST_F_OFST (2) #define RSTF_OFST (2)
#define RST_F_MSK (0x00000001 << RST_F_OFST) #define RSTF_MSK (0x00000001 << RSTF_OFST)
#define SW_TRIGGER_F_OFST (3) #define SWTRIGGERF_OFST (3)
#define SW_TRIGGER_F_MSK (0x00000001 << SW_TRIGGER_F_OFST) #define SWTRIGGERF_MSK (0x00000001 << SWTRIGGERF_OFST)
#define TRIGGER_ENABLE_OFST (4) #define TRIGGERENABLE_OFST (4)
#define TRIGGER_ENABLE_MSK (0x00000001 << TRIGGER_ENABLE_OFST) #define TRIGGERENABLE_MSK (0x00000001 << TRIGGERENABLE_OFST)
#define EMPTY10CREG (0x10C) #define EMPTY10CREG (0x10C)
#define TIME_FROM_START_OUT_REG_1 (0x110) #define TIMEFROMSTARTOUTREG1 (0x110)
#define TIME_FROM_START_OUT_REG_2 (0x114) #define TIMEFROMSTARTOUTREG2 (0x114)
#define FRAMES_FROM_START_OUT_REG_1 (0x118) #define FRAMESFROMSTARTOUTREG1 (0x118)
#define FRAMES_FROM_START_OUT_REG_2 (0x11C) #define FRAMESFROMSTARTOUTREG2 (0x11C)
#define FRAME_TIME_OUT_REG_1 (0x120) #define FRAMETIMEOUTREG1 (0x120)
#define FRAME_TIME_OUT_REG_2 (0x124) #define FRAMETIMEOUTREG2 (0x124)
#define DELAY_OUT_REG_1 (0x128) #define DELAYOUTREG1 (0x128)
#define DELAY_OUT_REG_2 (0x12C) #define DELAYOUTREG2 (0x12C)
#define CYCLES_OUT_REG_1 (0x130) #define CYCLESOUTREG1 (0x130)
#define CYCLES_OUT_REG_2 (0x134) #define CYCLESOUTREG2 (0x134)
#define FRAMES_OUT_REG_1 (0x138) #define FRAMESOUTREG1 (0x138)
#define FRAMES_OUT_REG_2 (0x13C) #define FRAMESOUTREG2 (0x13C)
#define PERIOD_OUT_REG_1 (0x140) #define PERIODOUTREG1 (0x140)
#define PERIOD_OUT_REG_2 (0x144) #define PERIODOUTREG2 (0x144)
#define DELAY_IN_REG_1 (0x148) #define DELAYINREG1 (0x148)
#define DELAY_IN_REG_2 (0x14C) #define DELAYINREG2 (0x14C)
#define CYCLES_IN_REG_1 (0x150) #define CYCLESINREG1 (0x150)
#define CYCLES_IN_REG_2 (0x154) #define CYCLESINREG2 (0x154)
#define FRAMES_IN_REG_1 (0x158) #define FRAMESINREG1 (0x158)
#define FRAMES_IN_REG_2 (0x15C) #define FRAMESINREG2 (0x15C)
#define PERIOD_IN_REG_1 (0x160) #define PERIODINREG1 (0x160)
#define PERIOD_IN_REG_2 (0x164) #define PERIODINREG2 (0x164)
#define EMPTY168REG (0x168) #define EMPTY168REG (0x168)
@ -504,15 +484,18 @@
#define EMPTY3FCREG (0x3FC) #define EMPTY3FCREG (0x3FC)
#define EMPTY400REG (0x400) #define EXPCTRLREG (0x400)
#define STARTP_OFST (0)
#define STARTP_MSK (0x00000001 << STARTP_OFST)
#define EMPTY404REG (0x404) #define EMPTY404REG (0x404)
#define EMPTY408REG (0x408) #define EXPFRAMESREG (0x408)
#define EMPTY40CREG (0x40C) #define EMPTY40CREG (0x40C)
#define EMPTY410REG (0x410) #define EXPTIMEREG (0x410)
#define EMPTY414REG (0x414) #define EMPTY414REG (0x414)
@ -632,56 +615,47 @@
#define EMPTY4FCREG (0x4FC) #define EMPTY4FCREG (0x4FC)
#define FIFO_TO_GB_CONTROL_REG (0x500) #define FIFOTOGBCONTROLREG (0x500)
#define ENABLED_CHANNELS_ADC_OFST (0) #define ENABLEDCHANNELS_OFST (0)
#define ENABLED_CHANNELS_ADC_MSK (0x000000ff << ENABLED_CHANNELS_ADC_OFST) #define ENABLEDCHANNELS_MSK (0x00001fff << ENABLEDCHANNELS_OFST)
#define ENABLED_CHANNELS_D_OFST (8) #define ROMODE_OFST (13)
#define ENABLED_CHANNELS_D_MSK (0x00000001 << ENABLED_CHANNELS_D_OFST) #define ROMODE_MSK (0x00000007 << ROMODE_OFST)
#define ENABLED_CHANNELS_X_OFST (9) #define COUNTFRAMESFROMUPDATE_OFST (16)
#define ENABLED_CHANNELS_X_MSK (0x0000000f << ENABLED_CHANNELS_X_OFST) #define COUNTFRAMESFROMUPDATE_MSK (0x00000001 << COUNTFRAMESFROMUPDATE_OFST)
#define RO_MODE_ADC_OFST (13) #define STARTSTREAMING_P_OFST (17)
#define RO_MODE_ADC_MSK (0x00000001 << RO_MODE_ADC_OFST) #define STARTSTREAMING_P_MSK (0x00000001 << STARTSTREAMING_P_OFST)
#define RO_MODE_D_OFST (14)
#define RO_MODE_D_MSK (0x00000001 << RO_MODE_D_OFST)
#define RO_MODE_X_OFST (15)
#define RO_MODE_X_MSK (0x00000001 << RO_MODE_X_OFST)
#define COUNT_FRAMES_FROM_UPDATE_OFST (16)
#define COUNT_FRAMES_FROM_UPDATE_MSK \
(0x00000001 << COUNT_FRAMES_FROM_UPDATE_OFST)
#define START_STREAMING_P_OFST (17)
#define START_STREAMING_P_MSK (0x00000001 << START_STREAMING_P_OFST)
#define EMPTY504REG (0x504) #define EMPTY504REG (0x504)
#define NO_SAMPLES_D_REG (0x508) #define NOSAMPLESDREG (0x508)
#define NO_SAMPLES_D_OFST (0) #define NOSAMPLESD_OFST (0)
#define NO_SAMPLES_D_MSK (0x00003fff << NO_SAMPLES_D_OFST) #define NOSAMPLESD_MSK (0x00003fff << NOSAMPLESD_OFST)
#define EMPTY50CREG (0x50C) #define EMPTY50CREG (0x50C)
#define NO_SAMPLES_A_REG (0x510) #define NOSAMPLESAREG (0x510)
#define NO_SAMPLES_A_OFST (0) #define NOSAMPLESA_OFST (0)
#define NO_SAMPLES_A_MSK (0x00003fff << NO_SAMPLES_A_OFST) #define NOSAMPLESA_MSK (0x00003fff << NOSAMPLESA_OFST)
#define EMPTY514REG (0x514) #define EMPTY514REG (0x514)
#define NO_SAMPLES_X_REG (0x518) #define NOSAMPLESXREG (0x518)
#define NO_SAMPLES_X_OFST (0) #define NOSAMPLESX_OFST (0)
#define NO_SAMPLES_X_MSK (0x00001fff << NO_SAMPLES_X_OFST) #define NOSAMPLESX_MSK (0x00001fff << NOSAMPLESX_OFST)
#define EMPTY51CREG (0x51C) #define EMPTY51CREG (0x51C)
#define COUNT_FRAMES_FROM_REG_1 (0x520) #define COUNTFRAMESFROMREG1 (0x520)
#define COUNT_FRAMES_FROM_REG_2 (0x524) #define COUNTFRAMESFROMREG2 (0x524)
#define LOCAL_FRAME_NUMBER_REG_1 (0x528) #define LOCALFRAMENUMBERREG1 (0x528)
#define LOCAL_FRAME_NUMBER_REG_2 (0x52C) #define LOCALFRAMENUMBERREG2 (0x52C)
#define EMPTY530REG (0x530) #define EMPTY530REG (0x530)
@ -723,75 +697,51 @@
#define EMPTY57CREG (0x57C) #define EMPTY57CREG (0x57C)
#define A_FIFO_OVERFLOW_STATUS_REG (0x580) #define EMPTY580REG (0x580)
#define EMPTY584REG (0x584) #define EMPTY584REG (0x584)
#define A_FIFO_EMPTY_STATUS_REG (0x588) #define EMPTY588REG (0x588)
#define EMPTY58CREG (0x58C) #define EMPTY58CREG (0x58C)
#define A_FIFO_FULL_STATUS_REG (0x590) #define EMPTY590REG (0x590)
#define EMPTY594REG (0x594) #define EMPTY594REG (0x594)
#define D_FIFO_OVERFLOW_STATUS_REG (0x598) #define EMPTY598REG (0x598)
#define D_FIFO_OVERFLOW_STATUS_OFST (0)
#define D_FIFO_OVERFLOW_STATUS_MSK (0x00000001 << D_FIFO_OVERFLOW_STATUS_OFST)
#define EMPTY59CREG (0x59C) #define EMPTY59CREG (0x59C)
#define D_FIFO_EMPTY_STATUS_REG (0x5A0) #define EMPTY5A0REG (0x5A0)
#define D_FIFO_EMPTY_STATUS_OFST (0)
#define D_FIFO_EMPTY_STATUS_MSK (0x00000001 << D_FIFO_EMPTY_STATUS_OFST)
#define EMPTY5A4REG (0x5A4) #define EMPTY5A4REG (0x5A4)
#define D_FIFO_FULL_STATUS_REG (0x5A8) #define EMPTY5A8REG (0x5A8)
#define D_FIFO_FULL_STATUS_OFST (0)
#define D_FIFO_FULL_STATUS_MSK (0x00000001 << D_FIFO_FULL_STATUS_OFST)
#define EMPTY5ACREG (0x5AC) #define EMPTY5ACREG (0x5AC)
#define X_FIFO_OVERFLOW_STATUS_REG (0x5B0) #define EMPTY5B0REG (0x5B0)
#define X_FIFO_OVERFLOW_STATUS_OFST (0)
#define X_FIFO_OVERFLOW_STATUS_MSK (0x0000000f << X_FIFO_OVERFLOW_STATUS_OFST)
#define EMPTY5B4REG (0x5B4) #define EMPTY5B4REG (0x5B4)
#define X_FIFO_EMPTY_STATUS_REG (0x5B8) #define EMPTY5B8REG (0x5B8)
#define X_FIFO_EMPTY_STATUS_OFST (0)
#define X_FIFO_EMPTY_STATUS_MSK (0x0000000f << X_FIFO_EMPTY_STATUS_OFST)
#define EMPTY5BCREG (0x5BC) #define EMPTY5BCREG (0x5BC)
#define X_FIFO_FULL_STATUS_REG (0x5C0) #define EMPTY5C0REG (0x5C0)
#define X_FIFO_FULL_STATUS_OFST (0)
#define X_FIFO_FULL_STATUS_MSK (0x0000000f << X_FIFO_FULL_STATUS_OFST)
#define EMPTY5C4REG (0x5C4) #define EMPTY5C4REG (0x5C4)
#define A_FIFO_CLEAN_REG (0x5C8) #define EMPTY5C8REG (0x5C8)
#define EMPTY5CCREG (0x5CC) #define EMPTY5CCREG (0x5CC)
#define D_FIFO_CLEAN_REG (0x5D0) #define EMPTY5D0REG (0x5D0)
#define D_FIFO_CLEAN_OFST (0)
#define D_FIFO_CLEAN_MSK (0x00000001 << D_FIFO_CLEAN_OFST)
#define EMPTY5D4REG (0x5D4) #define EMPTY5D4REG (0x5D4)
#define X_FIFO_CLEAN_REG (0x5D8) #define EMPTY5D8REG (0x5D8)
#define X_FIFO_CLEAN_OFST (0)
#define X_FIFO_CLEAN_MSK (0x0000000f << X_FIFO_CLEAN_OFST)
#define EMPTY5DCREG (0x5DC) #define EMPTY5DCREG (0x5DC)
@ -827,8 +777,6 @@
#define STARTREAD_P_MSK (0x00000001 << STARTREAD_P_OFST) #define STARTREAD_P_MSK (0x00000001 << STARTREAD_P_OFST)
#define BUSY_OFST (4) #define BUSY_OFST (4)
#define BUSY_MSK (0x00000001 << BUSY_OFST) #define BUSY_MSK (0x00000001 << BUSY_OFST)
#define READOUTFROMASIC_OFST (5)
#define READOUTFROMASIC_MSK (0x00000001 << READOUTFROMASIC_OFST)
#define EMPTY60CREG (0x60C) #define EMPTY60CREG (0x60C)

View File

@ -4,7 +4,7 @@
#include "RegisterDefs.h" #include "RegisterDefs.h"
#include "sls/sls_detector_defs.h" #include "sls/sls_detector_defs.h"
#define REQRD_FRMWRE_VRSN (0x230710) #define REQRD_FRMWRE_VRSN (0x230000)
#define KERNEL_DATE_VRSN "Wed Nov 29 17:32:14 CET 2023" #define KERNEL_DATE_VRSN "Wed Nov 29 17:32:14 CET 2023"
#define LINKED_SERVER_NAME "xilinx_ctbDetectorServer" #define LINKED_SERVER_NAME "xilinx_ctbDetectorServer"
@ -12,134 +12,16 @@
#define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000) #define CTRL_SRVR_INIT_TIME_US (2 * 1000 * 1000)
/* Hardware Definitions */ /* Hardware Definitions */
#define NCHAN (40) #define NCHAN (1)
#define NCHAN_ANALOG (32)
#define NCHAN_DIGITAL (64)
#define NCHAN_TRANSCEIVER (4)
#define NBITS_PER_TRANSCEIVER (64)
#define NCHIP (1)
#define NDAC (24)
#define NPWR (6)
#define NDAC_ONLY (NDAC - NPWR)
#define DYNAMIC_RANGE (16) enum ADCINDEX { V_PWR_IO };
#define NUM_BYTES_PER_PIXEL (DYNAMIC_RANGE / 8) enum DACINDEX { D0 };
#define DAC_DRIVER_NUM_DEVICES (3)
#define DAC_DRIVER_FILE_NAME \
("/sys/bus/iio/devices/iio:device%d/out_voltage%d_raw")
#define DAC_POWERDOWN_DRIVER_FILE_NAME \
("/sys/bus/iio/devices/iio:device%d/out_voltage%d_powerdown")
#define SLOWADC_DRIVER_FILE_NAME \
("/sys/bus/iio/devices/iio:device%d/in_voltage%d_raw")
//#define SLOWDAC_CONVERTION_FACTOR_TO_UV (62.500953)
#define TEMP_DRIVER_FILE_NAME \
("/sys/bus/iio/devices/iio:device0/in_temp7_input")
/** Default Parameters */ /** Default Parameters */
#define DEFAULT_NUM_FRAMES (1) #define DEFAULT_NUM_FRAMES (1)
#define DEFAULT_NUM_CYCLES (1) #define DEFAULT_NUM_CYCLES (1)
#define DYNAMIC_RANGE (16)
#define DEFAULT_TIMING_MODE (AUTO_TIMING) #define DEFAULT_TIMING_MODE (AUTO_TIMING)
#define DEFAULT_EXPTIME (0)
#define DEFAULT_PERIOD (300 * 1000) // 300us
#define DEFAULT_READOUT_MODE (TRANSCEIVER_ONLY)
#define DEFAULT_READOUT_MODE_STR "transceiver_only"
#define DEFAULT_TRANSCEIVER_MASK (0x3) // TODO: check
#define DEFAULT_NUM_ASAMPLES (1)
#define DEFAULT_NUM_DSAMPLES (1)
#define DEFAULT_NUM_TSAMPLES (200)
#define DEFAULT_STARTING_FRAME_NUMBER (1)
#define DEFAULT_VLIMIT (-100)
#define DEFAULT_DELAY (0)
#define MAX_TRANSCEIVER_MASK (0xF)
#define MAX_TRANSCEIVER_SAMPLES (0x1FFF)
#define MAX_ANALOG_SAMPLES (0x3FFF)
#define MAX_DIGITAL_SAMPLES (0x3FFF)
#define DAC_MIN_MV (0)
#define DAC_MAX_MV (2500)
#define TICK_CLK (20) // MHz (trig_timeFromStart, frametime, timeFromStart)
#define RUN_CLK \
(100) // MHz (framesFromStart, c_swTrigger, run, waitForTrigger, starting,
// acquiring, waitForPeriod, internalStop, c_framesFromSTart_reset,
// s_start, c_stop, triggerEnable, period, frames, cycles, delay)
/* Defines in the Firmware */ /* Defines in the Firmware */
#define WAIT_TIME_PATTERN_READ (10) #define WAIT_TIME_PATTERN_READ (10)
#define WAIT_TIME_OUT_0US_TIMES (35000) // 2s
#define BIT32_MSK (0xFFFFFFFF)
#define BIT16_MASK (0xFFFF)
#define MAX_DATA_SIZE_IN_PACKET (8144)
/* Enum Definitions */
enum ADCINDEX {
S_ADC0,
S_ADC1,
S_ADC2,
S_ADC3,
S_ADC4,
S_ADC5,
S_ADC6,
S_ADC7,
TEMP_FPGA
};
enum DACINDEX {
D0,
D1,
D2,
D3,
D4,
D5,
D6,
D7,
D8,
D9,
D10,
D11,
D12,
D13,
D14,
D15,
D16,
D17,
D_PWR_D,
D_PWR_EMPTY,
D_PWR_IO,
D_PWR_A,
D_PWR_B,
D_PWR_C
};
/* Struct Definitions */
typedef struct udp_header_struct {
uint32_t udp_destmac_msb;
uint16_t udp_srcmac_msb;
uint16_t udp_destmac_lsb;
uint32_t udp_srcmac_lsb;
uint8_t ip_tos;
uint8_t ip_ihl : 4, ip_ver : 4;
uint16_t udp_ethertype;
uint16_t ip_identification;
uint16_t ip_totallength;
uint8_t ip_protocol;
uint8_t ip_ttl;
uint16_t ip_fragmentoffset : 13, ip_flags : 3;
uint16_t ip_srcip_msb;
uint16_t ip_checksum;
uint16_t ip_destip_msb;
uint16_t ip_srcip_lsb;
uint16_t udp_srcport;
uint16_t ip_destip_lsb;
uint16_t udp_checksum;
uint16_t udp_destport;
} udp_header;
#define IP_HEADER_SIZE (20)
#define UDP_IP_HEADER_LENGTH_BYTES (28)

View File

@ -80,7 +80,7 @@ _sd() {
local IS_PATH=0 local IS_PATH=0
local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clearroi clientversion clkdiv clkfreq clkphase column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 exptimel extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit patternX patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga roi romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport " local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clearroi clientversion clkdiv clkfreq clkphase column compdisabletime confadc config counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 exptimel extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit patternX patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga roi romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport "
__acquire() { __acquire() {
FCN_RETURN="" FCN_RETURN=""
return 0 return 0
@ -477,16 +477,6 @@ fi
fi fi
return 0 return 0
} }
__configtransceiver() {
FCN_RETURN=""
if [[ ${IS_GET} -eq 1 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
IS_PATH=1
fi
fi
return 0
}
__counters() { __counters() {
FCN_RETURN="" FCN_RETURN=""
return 0 return 0

View File

@ -4,7 +4,7 @@
_sd() { _sd() {
local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clearroi clientversion clkdiv clkfreq clkphase column compdisabletime confadc config configtransceiver counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 exptimel extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit patternX patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga roi romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport " local SLS_COMMANDS=" acquire activate adcclk adcenable adcenable10g adcindex adcinvert adclist adcname adcphase adcpipeline adcreg adcvpp apulse asamples autocompdisable badchannels blockingtrigger burstmode burstperiod bursts burstsl bustest cdsgain chipversion clearbit clearbusy clearroi clientversion clkdiv clkfreq clkphase column compdisabletime confadc config counters currentsource dac dacindex daclist dacname dacvalues datastream dbitclk dbitphase dbitpipeline defaultdac defaultpattern delay delayl detectorserverversion detsize diodelay dpulse dr drlist dsamples execcommand exptime exptime1 exptime2 exptime3 exptimel extrastoragecells extsampling extsamplingsrc extsig fformat filtercells filterresistor findex firmwaretest firmwareversion fliprows flowcontrol10g fmaster fname foverwrite fpath framecounter frames framesl frametime free fwrite gaincaps gainmode gappixels gatedelay gatedelay1 gatedelay2 gatedelay3 gates getbit hardwareversion highvoltage hostname im_a im_b im_c im_d im_io imagetest initialchecks inj_ch interpolation interruptsubframe kernelversion lastclient led lock master maxadcphaseshift maxclkphaseshift maxdbitphaseshift measuredperiod measuredsubperiod moduleid nextframenumber nmod numinterfaces overflow packageversion parallel parameters partialreset patfname patioctrl patlimits patloop patloop0 patloop1 patloop2 patmask patnloop patnloop0 patnloop1 patnloop2 patsetbit patternX patternstart patwait patwait0 patwait1 patwait2 patwaittime patwaittime0 patwaittime1 patwaittime2 patword pedestalmode period periodl polarity port powerchip powerindex powerlist powername powervalues programfpga pulse pulsechip pulsenmove pumpprobe quad ratecorr readnrows readout readoutspeed readoutspeedlist rebootcontroller reg resetdacs resetfpga roi romode row runclk runtime rx_arping rx_clearroi rx_dbitlist rx_dbitoffset rx_discardpolicy rx_fifodepth rx_frameindex rx_framescaught rx_framesperfile rx_hostname rx_jsonaddheader rx_jsonpara rx_lastclient rx_lock rx_missingpackets rx_padding rx_printconfig rx_realudpsocksize rx_roi rx_silent rx_start rx_status rx_stop rx_tcpport rx_threads rx_udpsocksize rx_version rx_zmqfreq rx_zmqhwm rx_zmqip rx_zmqport rx_zmqstartfnum rx_zmqstream samples savepattern scan scanerrmsg selinterface serialnumber setbit settings settingslist settingspath signalindex signallist signalname slowadc slowadcindex slowadclist slowadcname slowadcvalues start status stop stopport storagecell_delay storagecell_start subdeadtime subexptime sync syncclk temp_10ge temp_adc temp_control temp_dcdc temp_event temp_fpga temp_fpgaext temp_fpgafl temp_fpgafr temp_slowadc temp_sodl temp_sodr temp_threshold templist tempvalues tengiga threshold thresholdnotb timing timinglist timingsource top transceiverenable trigger triggers triggersl trimbits trimen trimval tsamples txdelay txdelay_frame txdelay_left txdelay_right type udp_cleardst udp_dstip udp_dstip2 udp_dstlist udp_dstmac udp_dstmac2 udp_dstport udp_dstport2 udp_firstdst udp_numdst udp_reconfigure udp_srcip udp_srcip2 udp_srcmac udp_srcmac2 udp_validate update updatedetectorserver updatekernel updatemode user v_a v_b v_c v_chip v_d v_io v_limit vchip_comp_adc vchip_comp_fe vchip_cs vchip_opa_1st vchip_opa_fd vchip_ref_comp_fe versions veto vetoalg vetofile vetophoton vetoref vetostream virtual vm_a vm_b vm_c vm_d vm_io zmqhwm zmqip zmqport "
__acquire() { __acquire() {
FCN_RETURN="" FCN_RETURN=""
return 0 return 0
@ -401,16 +401,6 @@ fi
fi fi
return 0 return 0
} }
__configtransceiver() {
FCN_RETURN=""
if [[ ${IS_GET} -eq 1 ]]; then
if [[ "${cword}" == "2" ]]; then
FCN_RETURN=""
IS_PATH=1
fi
fi
return 0
}
__counters() { __counters() {
FCN_RETURN="" FCN_RETURN=""
return 0 return 0

View File

@ -441,7 +441,7 @@ period:
function: setPeriod function: setPeriod
delay: delay:
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Moench][Xilinx Ctb] Delay after trigger" help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Moench] Delay after trigger"
inherit_actions: TIME_COMMAND inherit_actions: TIME_COMMAND
actions: actions:
GET: GET:
@ -496,14 +496,14 @@ burstperiod:
################# TIME_GET_COMMAND ############# ################# TIME_GET_COMMAND #############
delayl: delayl:
help: "\n\t[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Delay Left in Acquisition. \n\t[Gotthard2] only in continuous mode." help: "\n\t[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Delay Left in Acquisition. \n\t[Gotthard2] only in continuous mode."
inherit_actions: TIME_GET_COMMAND inherit_actions: TIME_GET_COMMAND
actions: actions:
GET: GET:
function: getDelayAfterTriggerLeft function: getDelayAfterTriggerLeft
periodl: periodl:
help: "\n\t[Gotthard][Jungfrau][Moench][Ctb][Mythen3][Gotthard2][Xilinx Ctb] Period left for current frame. \n\t[Gotthard2] only in continuous mode." help: "\n\t[Gotthard][Jungfrau][Moench][Ctb][Mythen3][Gotthard2] Period left for current frame. \n\t[Gotthard2] only in continuous mode."
inherit_actions: TIME_GET_COMMAND inherit_actions: TIME_GET_COMMAND
actions: actions:
GET: GET:
@ -531,14 +531,14 @@ exptimel:
function: getExptimeLeft function: getExptimeLeft
runtime: runtime:
help: "[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Time from detector start up.\n\t[Gotthard2] not in burst and auto mode." help: "[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Time from detector start up.\n\t[Gotthard2] not in burst and auto mode."
inherit_actions: TIME_GET_COMMAND inherit_actions: TIME_GET_COMMAND
actions: actions:
GET: GET:
function: getActualTime function: getActualTime
frametime: frametime:
help: "[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Timestamp at a frame start.\n\t[Gotthard2] not in burst and auto mode." help: "[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Timestamp at a frame start.\n\t[Gotthard2] not in burst and auto mode."
inherit_actions: TIME_GET_COMMAND inherit_actions: TIME_GET_COMMAND
actions: actions:
GET: GET:
@ -622,7 +622,7 @@ adcenable10g:
function: setTenGigaADCEnableMask function: setTenGigaADCEnableMask
transceiverenable: transceiverenable:
help: "[bitmask]\n\t[Ctb][Xilinx Ctb] Transceiver Enable Mask. Enable for each 4 Transceiver channel." help: "[bitmask]\n\t[Ctb] Transceiver Enable Mask. Enable for each 4 Transceiver channel."
inherit_actions: INTEGER_COMMAND_HEX inherit_actions: INTEGER_COMMAND_HEX
actions: actions:
GET: GET:
@ -707,7 +707,7 @@ highvoltage:
function: setHighVoltage function: setHighVoltage
powerchip: powerchip:
help: "[0, 1]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Xilinx Ctb] Power the chip. \n\t[Jungfrau][Moench] Default is 0. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1)\n\t[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail.\n\t[Xilinx Ctb] Default is 0. Also configures the chip if powered on." help: "[0, 1]\n\t[Jungfrau][Moench][Mythen3][Gotthard2] Power the chip. \n\t[Jungfrau][Moench] Default is 0. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1)\n\t[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail."
inherit_actions: INTEGER_COMMAND_VEC_ID inherit_actions: INTEGER_COMMAND_VEC_ID
actions: actions:
GET: GET:
@ -764,7 +764,7 @@ readnrows:
function: setReadNRows function: setReadNRows
nextframenumber: nextframenumber:
help: "[n_value]\n\t[Eiger][Jungfrau][Moench][Ctb][Xilinx Ctb] Next frame number. Stopping acquisition might result in different frame numbers for different modules." help: "[n_value]\n\t[Eiger][Jungfrau][Moench][Ctb] Next frame number. Stopping acquisition might result in different frame numbers for different modules."
inherit_actions: INTEGER_COMMAND_VEC_ID inherit_actions: INTEGER_COMMAND_VEC_ID
actions: actions:
GET: GET:
@ -1298,7 +1298,7 @@ dsamples:
function: setNumberOfDigitalSamples function: setNumberOfDigitalSamples
tsamples: tsamples:
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Number of transceiver samples expected." help: "[n_value]\n\t[Ctb] Number of transceiver samples expected."
inherit_actions: INTEGER_COMMAND_VEC_ID inherit_actions: INTEGER_COMMAND_VEC_ID
actions: actions:
GET: GET:
@ -1307,7 +1307,7 @@ tsamples:
function: setNumberOfTransceiverSamples function: setNumberOfTransceiverSamples
romode: romode:
help: "[analog|digital|analog_digital|transceiver|digital_transceiver]\n\t[Ctb][xilinx Ctb] Readout mode. [Ctb] Default is analog. [Xilinx Ctb] Default is Transceiver (only one implemented so far)" help: "[analog|digital|analog_digital|transceiver|digital_transceiver]\n\t[Ctb] Readout mode. Default is analog."
inherit_actions: INTEGER_COMMAND_VEC_ID inherit_actions: INTEGER_COMMAND_VEC_ID
actions: actions:
GET: GET:
@ -1555,7 +1555,7 @@ fmaster:
################# INTEGER_IND_COMMAND ####################### ################# INTEGER_IND_COMMAND #######################
v_limit: v_limit:
inherit_actions: INTEGER_IND_COMMAND inherit_actions: INTEGER_IND_COMMAND
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Soft limit for power supplies (ctb only) and DACS in mV." help: "[n_value]\n\t[Ctb] Soft limit for power supplies (ctb only) and DACS in mV."
actions: actions:
GET: GET:
function: getPower function: getPower
@ -1566,7 +1566,7 @@ v_limit:
v_a: v_a:
inherit_actions: INTEGER_IND_COMMAND inherit_actions: INTEGER_IND_COMMAND
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply a in mV." help: "[n_value]\n\t[Ctb] Power supply a in mV."
actions: actions:
GET: GET:
function: getPower function: getPower
@ -1577,7 +1577,7 @@ v_a:
v_b: v_b:
inherit_actions: INTEGER_IND_COMMAND inherit_actions: INTEGER_IND_COMMAND
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply b in mV." help: "[n_value]\n\t[Ctb] Power supply b in mV."
actions: actions:
GET: GET:
function: getPower function: getPower
@ -1588,7 +1588,7 @@ v_b:
v_c: v_c:
inherit_actions: INTEGER_IND_COMMAND inherit_actions: INTEGER_IND_COMMAND
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply c in mV." help: "[n_value]\n\t[Ctb] Power supply c in mV."
actions: actions:
GET: GET:
function: getPower function: getPower
@ -1599,7 +1599,7 @@ v_c:
v_d: v_d:
inherit_actions: INTEGER_IND_COMMAND inherit_actions: INTEGER_IND_COMMAND
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply d in mV." help: "[n_value]\n\t[Ctb] Power supply d in mV."
actions: actions:
GET: GET:
function: getPower function: getPower
@ -1610,7 +1610,7 @@ v_d:
v_io: v_io:
inherit_actions: INTEGER_IND_COMMAND inherit_actions: INTEGER_IND_COMMAND
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply io in mV. Minimum 1200 mV. Must be the first power regulator to be set after fpga reset (on-board detector server start up)." help: "[n_value]\n\t[Ctb] Power supply io in mV. Minimum 1200 mV. Must be the first power regulator to be set after fpga reset (on-board detector server start up)."
actions: actions:
GET: GET:
function: getPower function: getPower
@ -1792,21 +1792,21 @@ patternstart:
resetfpga: resetfpga:
inherit_actions: EXECUTE_SET_COMMAND inherit_actions: EXECUTE_SET_COMMAND
help: "\n\t[Jungfrau][Moench][Ctb][Xilinx Ctb] Reset FPGA." help: "\n\t[Jungfrau][Moench][Ctb] Reset FPGA."
actions: actions:
PUT: PUT:
function: resetFPGA function: resetFPGA
rebootcontroller: rebootcontroller:
inherit_actions: EXECUTE_SET_COMMAND inherit_actions: EXECUTE_SET_COMMAND
help: "\n\t[Jungfrau][Moench][Ctb][Gotthard][Mythen3][Gotthard2][Xilinx Ctb] Reboot controller of detector." help: "\n\t[Jungfrau][Moench][Ctb][Gotthard][Mythen3][Gotthard2] Reboot controller of detector."
actions: actions:
PUT: PUT:
function: rebootController function: rebootController
firmwaretest: firmwaretest:
inherit_actions: EXECUTE_SET_COMMAND inherit_actions: EXECUTE_SET_COMMAND
help: "\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Firmware test, ie. reads a read fixed pattern from a register." help: "\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb] Firmware test, ie. reads a read fixed pattern from a register."
actions: actions:
PUT: PUT:
function: executeFirmwareTest function: executeFirmwareTest
@ -1818,13 +1818,6 @@ bustest:
PUT: PUT:
function: executeBusTest function: executeBusTest
configtransceiver:
inherit_actions: EXECUTE_SET_COMMAND
help: "\n\t[Xilinx Ctb] Waits for transceiver to be aligned. Chip had to be configured (powered on) before this."
actions:
PUT:
function: configureTransceiver
################# EXECUTE_SET_COMMAND_NOID_1ARG ############## ################# EXECUTE_SET_COMMAND_NOID_1ARG ##############
config: config:
inherit_actions: EXECUTE_SET_COMMAND_NOID_1ARG inherit_actions: EXECUTE_SET_COMMAND_NOID_1ARG
@ -2018,7 +2011,7 @@ lastclient:
framecounter: framecounter:
inherit_actions: GET_COMMAND inherit_actions: GET_COMMAND
help: "\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Number of frames from start run control.\n\t[Gotthard2] only in continuous mode." help: "\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Number of frames from start run control.\n\t[Gotthard2] only in continuous mode."
actions: actions:
GET: GET:
function: getNumberOfFramesFromStart function: getNumberOfFramesFromStart
@ -2087,7 +2080,7 @@ temp_adc:
temp_fpga: temp_fpga:
inherit_actions: GET_IND_COMMAND inherit_actions: GET_IND_COMMAND
help: "[n_value]\n\t[Eiger][Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Xilinx CTB] FPGA Temperature" help: "[n_value]\n\t[Eiger][Jungfrau][Moench][Gotthard][Mythen3][Gotthard2] FPGA Temperature"
actions: actions:
GET: GET:
function: getTemperature function: getTemperature
@ -2314,7 +2307,7 @@ slowadcvalues:
GETFCNLIST: getSlowADCList GETFCNLIST: getSlowADCList
GETFCNNAME: getSlowADCNames GETFCNNAME: getSlowADCNames
GETFCN: getSlowADC GETFCN: getSlowADC
suffix: "uV" suffix: "mV"
printable_name: "*name_it++" printable_name: "*name_it++"
tempvalues: tempvalues:
@ -2825,7 +2818,7 @@ Exptime:
exptime: exptime:
inherit_actions: Exptime inherit_actions: Exptime
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Ctb][Xilinx Ctb] Exposure time\n\t[Mythen3] Exposure time of all gate signals in auto and trigger mode (internal gating). To specify gate index, use exptime1, exptime2, exptime3." help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Ctb] Exposure time\n\t[Mythen3] Exposure time of all gate signals in auto and trigger mode (internal gating). To specify gate index, use exptime1, exptime2, exptime3."
actions: actions:
GET: GET:
function: getExptime function: getExptime

View File

@ -1615,28 +1615,6 @@ config:
help: "\n\tFrees shared memory before loading configuration file. Set up once." help: "\n\tFrees shared memory before loading configuration file. Set up once."
infer_action: true infer_action: true
template: true template: true
configtransceiver:
actions:
PUT:
args:
- arg_types: []
argc: 0
cast_input: []
check_det_id: false
convert_det_id: true
function: configureTransceiver
input: []
input_types: []
output:
- '"successful"'
require_det_id: true
store_result_in_t: false
command_name: configtransceiver
function_alias: configtransceiver
help: "\n\t[Xilinx Ctb] Waits for transceiver to be aligned. Chip had to be configured\
\ (powered on) before this."
infer_action: true
template: true
counters: counters:
actions: actions:
GET: GET:
@ -2517,8 +2495,8 @@ delay:
store_result_in_t: false store_result_in_t: false
command_name: delay command_name: delay
function_alias: delay function_alias: delay
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Moench][Xilinx\ help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Moench]\
\ Ctb] Delay after trigger" \ Delay after trigger"
infer_action: true infer_action: true
template: true template: true
delayl: delayl:
@ -2552,8 +2530,8 @@ delayl:
store_result_in_t: true store_result_in_t: true
command_name: delayl command_name: delayl
function_alias: delayl function_alias: delayl
help: "\n\t[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Delay\ help: "\n\t[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Delay Left in Acquisition.\
\ Left in Acquisition. \n\t[Gotthard2] only in continuous mode." \ \n\t[Gotthard2] only in continuous mode."
infer_action: true infer_action: true
template: true template: true
detectorserverversion: detectorserverversion:
@ -2913,10 +2891,9 @@ exptime:
store_result_in_t: false store_result_in_t: false
command_name: exptime command_name: exptime
function_alias: exptime function_alias: exptime
help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Ctb][Xilinx\ help: "[duration] [(optional unit) ns|us|ms|s]\n\t[Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Ctb]\
\ Ctb] Exposure time\n\t[Mythen3] Exposure time of all gate signals in auto and\ \ Exposure time\n\t[Mythen3] Exposure time of all gate signals in auto and trigger\
\ trigger mode (internal gating). To specify gate index, use exptime1, exptime2,\ \ mode (internal gating). To specify gate index, use exptime1, exptime2, exptime3."
\ exptime3."
infer_action: true infer_action: true
template: true template: true
exptime1: exptime1:
@ -3633,8 +3610,8 @@ firmwaretest:
store_result_in_t: false store_result_in_t: false
command_name: firmwaretest command_name: firmwaretest
function_alias: firmwaretest function_alias: firmwaretest
help: "\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Firmware\ help: "\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb] Firmware test,\
\ test, ie. reads a read fixed pattern from a register." \ ie. reads a read fixed pattern from a register."
infer_action: true infer_action: true
template: true template: true
firmwareversion: firmwareversion:
@ -3929,8 +3906,8 @@ framecounter:
store_result_in_t: true store_result_in_t: true
command_name: framecounter command_name: framecounter
function_alias: framecounter function_alias: framecounter
help: "\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Number of frames\ help: "\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Number of frames from start\
\ from start run control.\n\t[Gotthard2] only in continuous mode." \ run control.\n\t[Gotthard2] only in continuous mode."
infer_action: true infer_action: true
template: true template: true
frames: frames:
@ -4028,8 +4005,8 @@ frametime:
store_result_in_t: true store_result_in_t: true
command_name: frametime command_name: frametime
function_alias: frametime function_alias: frametime
help: "[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx\ help: "[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb]\
\ Ctb] Timestamp at a frame start.\n\t[Gotthard2] not in burst and auto mode." \ Timestamp at a frame start.\n\t[Gotthard2] not in burst and auto mode."
infer_action: true infer_action: true
template: true template: true
free: free:
@ -5497,8 +5474,8 @@ nextframenumber:
store_result_in_t: false store_result_in_t: false
command_name: nextframenumber command_name: nextframenumber
function_alias: nextframenumber function_alias: nextframenumber
help: "[n_value]\n\t[Eiger][Jungfrau][Moench][Ctb][Xilinx Ctb] Next frame number.\ help: "[n_value]\n\t[Eiger][Jungfrau][Moench][Ctb] Next frame number. Stopping acquisition\
\ Stopping acquisition might result in different frame numbers for different modules." \ might result in different frame numbers for different modules."
infer_action: true infer_action: true
template: true template: true
nmod: nmod:
@ -7202,8 +7179,8 @@ periodl:
store_result_in_t: true store_result_in_t: true
command_name: periodl command_name: periodl
function_alias: periodl function_alias: periodl
help: "\n\t[Gotthard][Jungfrau][Moench][Ctb][Mythen3][Gotthard2][Xilinx Ctb] Period\ help: "\n\t[Gotthard][Jungfrau][Moench][Ctb][Mythen3][Gotthard2] Period left for\
\ left for current frame. \n\t[Gotthard2] only in continuous mode." \ current frame. \n\t[Gotthard2] only in continuous mode."
infer_action: true infer_action: true
template: true template: true
polarity: polarity:
@ -7322,12 +7299,11 @@ powerchip:
store_result_in_t: false store_result_in_t: false
command_name: powerchip command_name: powerchip
function_alias: powerchip function_alias: powerchip
help: "[0, 1]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Xilinx Ctb] Power the chip.\ help: "[0, 1]\n\t[Jungfrau][Moench][Mythen3][Gotthard2] Power the chip. \n\t[Jungfrau][Moench]\
\ \n\t[Jungfrau][Moench] Default is 0. Get will return power status. Can be off\ \ Default is 0. Get will return power status. Can be off if temperature event\
\ if temperature event occured (temperature over temp_threshold with temp_control\ \ occured (temperature over temp_threshold with temp_control enabled. Will configure\
\ enabled. Will configure chip (only chip v1.1)\n\t[Mythen3][Gotthard2] Default\ \ chip (only chip v1.1)\n\t[Mythen3][Gotthard2] Default is 1. If module not connected\
\ is 1. If module not connected or wrong module, powerchip will fail.\n\t[Xilinx\ \ or wrong module, powerchip will fail."
\ Ctb] Default is 0. Also configures the chip if powered on."
infer_action: true infer_action: true
template: true template: true
powerindex: powerindex:
@ -7939,8 +7915,8 @@ rebootcontroller:
store_result_in_t: false store_result_in_t: false
command_name: rebootcontroller command_name: rebootcontroller
function_alias: rebootcontroller function_alias: rebootcontroller
help: "\n\t[Jungfrau][Moench][Ctb][Gotthard][Mythen3][Gotthard2][Xilinx Ctb] Reboot\ help: "\n\t[Jungfrau][Moench][Ctb][Gotthard][Mythen3][Gotthard2] Reboot controller\
\ controller of detector." \ of detector."
infer_action: true infer_action: true
template: true template: true
reg: reg:
@ -8054,7 +8030,7 @@ resetfpga:
store_result_in_t: false store_result_in_t: false
command_name: resetfpga command_name: resetfpga
function_alias: resetfpga function_alias: resetfpga
help: "\n\t[Jungfrau][Moench][Ctb][Xilinx Ctb] Reset FPGA." help: "\n\t[Jungfrau][Moench][Ctb] Reset FPGA."
infer_action: true infer_action: true
template: true template: true
roi: roi:
@ -8141,9 +8117,8 @@ romode:
store_result_in_t: false store_result_in_t: false
command_name: romode command_name: romode
function_alias: romode function_alias: romode
help: "[analog|digital|analog_digital|transceiver|digital_transceiver]\n\t[Ctb][xilinx\ help: "[analog|digital|analog_digital|transceiver|digital_transceiver]\n\t[Ctb]\
\ Ctb] Readout mode. [Ctb] Default is analog. [Xilinx Ctb] Default is Transceiver\ \ Readout mode. Default is analog."
\ (only one implemented so far)"
infer_action: true infer_action: true
template: true template: true
row: row:
@ -8256,8 +8231,8 @@ runtime:
store_result_in_t: true store_result_in_t: true
command_name: runtime command_name: runtime
function_alias: runtime function_alias: runtime
help: "[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx\ help: "[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][Ctb]\
\ Ctb] Time from detector start up.\n\t[Gotthard2] not in burst and auto mode." \ Time from detector start up.\n\t[Gotthard2] not in burst and auto mode."
infer_action: true infer_action: true
template: true template: true
rx_arping: rx_arping:
@ -10121,7 +10096,7 @@ slowadcvalues:
GETFCNLIST: getSlowADCList GETFCNLIST: getSlowADCList
GETFCNNAME: getSlowADCNames GETFCNNAME: getSlowADCNames
printable_name: '*name_it++' printable_name: '*name_it++'
suffix: uV suffix: mV
function: '' function: ''
input: [] input: []
input_types: [] input_types: []
@ -10784,8 +10759,8 @@ temp_fpga:
store_result_in_t: true store_result_in_t: true
command_name: temp_fpga command_name: temp_fpga
function_alias: temp_fpga function_alias: temp_fpga
help: "[n_value]\n\t[Eiger][Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Xilinx\ help: "[n_value]\n\t[Eiger][Jungfrau][Moench][Gotthard][Mythen3][Gotthard2] FPGA\
\ CTB] FPGA Temperature" \ Temperature"
infer_action: true infer_action: true
template: true template: true
temp_fpgaext: temp_fpgaext:
@ -11396,8 +11371,8 @@ transceiverenable:
store_result_in_t: false store_result_in_t: false
command_name: transceiverenable command_name: transceiverenable
function_alias: transceiverenable function_alias: transceiverenable
help: "[bitmask]\n\t[Ctb][Xilinx Ctb] Transceiver Enable Mask. Enable for each 4\ help: "[bitmask]\n\t[Ctb] Transceiver Enable Mask. Enable for each 4 Transceiver\
\ Transceiver channel." \ channel."
infer_action: true infer_action: true
template: true template: true
trigger: trigger:
@ -11642,7 +11617,7 @@ tsamples:
store_result_in_t: false store_result_in_t: false
command_name: tsamples command_name: tsamples
function_alias: tsamples function_alias: tsamples
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Number of transceiver samples expected." help: "[n_value]\n\t[Ctb] Number of transceiver samples expected."
infer_action: true infer_action: true
template: true template: true
txdelay: txdelay:
@ -12603,7 +12578,7 @@ v_a:
store_result_in_t: false store_result_in_t: false
command_name: v_a command_name: v_a
function_alias: v_a function_alias: v_a
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply a in mV." help: "[n_value]\n\t[Ctb] Power supply a in mV."
infer_action: true infer_action: true
template: true template: true
v_b: v_b:
@ -12649,7 +12624,7 @@ v_b:
store_result_in_t: false store_result_in_t: false
command_name: v_b command_name: v_b
function_alias: v_b function_alias: v_b
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply b in mV." help: "[n_value]\n\t[Ctb] Power supply b in mV."
infer_action: true infer_action: true
template: true template: true
v_c: v_c:
@ -12695,7 +12670,7 @@ v_c:
store_result_in_t: false store_result_in_t: false
command_name: v_c command_name: v_c
function_alias: v_c function_alias: v_c
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply c in mV." help: "[n_value]\n\t[Ctb] Power supply c in mV."
infer_action: true infer_action: true
template: true template: true
v_chip: v_chip:
@ -12788,7 +12763,7 @@ v_d:
store_result_in_t: false store_result_in_t: false
command_name: v_d command_name: v_d
function_alias: v_d function_alias: v_d
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply d in mV." help: "[n_value]\n\t[Ctb] Power supply d in mV."
infer_action: true infer_action: true
template: true template: true
v_io: v_io:
@ -12834,9 +12809,8 @@ v_io:
store_result_in_t: false store_result_in_t: false
command_name: v_io command_name: v_io
function_alias: v_io function_alias: v_io
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Power supply io in mV. Minimum 1200 mV. Must\ help: "[n_value]\n\t[Ctb] Power supply io in mV. Minimum 1200 mV. Must be the first\
\ be the first power regulator to be set after fpga reset (on-board detector server\ \ power regulator to be set after fpga reset (on-board detector server start up)."
\ start up)."
infer_action: true infer_action: true
template: true template: true
v_limit: v_limit:
@ -12882,8 +12856,7 @@ v_limit:
store_result_in_t: false store_result_in_t: false
command_name: v_limit command_name: v_limit
function_alias: v_limit function_alias: v_limit
help: "[n_value]\n\t[Ctb][Xilinx Ctb] Soft limit for power supplies (ctb only) and\ help: "[n_value]\n\t[Ctb] Soft limit for power supplies (ctb only) and DACS in mV."
\ DACS in mV."
infer_action: true infer_action: true
template: true template: true
vchip_comp_adc: vchip_comp_adc:

View File

@ -303,11 +303,11 @@ class Detector {
void setNumberOfTriggers(int64_t value); void setNumberOfTriggers(int64_t value);
/** [Gotthard][Jungfrau][Moench][Eiger][CTB][Xilinx CTB][Gotthard2] \n /** [Gotthard][Jungfrau][Moench][Eiger][CTB][Gotthard2] \n
* [Mythen3] use function with gate index **/ * [Mythen3] use function with gate index **/
Result<ns> getExptime(Positions pos = {}) const; Result<ns> getExptime(Positions pos = {}) const;
/** [Gotthard][Jungfrau][Moench][Eiger][CTB][Xilinx CTB][Gotthard2] \n /** [Gotthard][Jungfrau][Moench][Eiger][CTB][Gotthard2] \n
* [Mythen3] sets exptime for all gate signals. To specify gate index, use * [Mythen3] sets exptime for all gate signals. To specify gate index, use
* function with gate index **/ * function with gate index **/
void setExptime(ns t, Positions pos = {}); void setExptime(ns t, Positions pos = {});
@ -316,10 +316,10 @@ class Detector {
void setPeriod(ns t, Positions pos = {}); void setPeriod(ns t, Positions pos = {});
/** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2][Xilinx CTB] */ /** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2] */
Result<ns> getDelayAfterTrigger(Positions pos = {}) const; Result<ns> getDelayAfterTrigger(Positions pos = {}) const;
/** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2][Xilinx CTB] */ /** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2] */
void setDelayAfterTrigger(ns value, Positions pos = {}); void setDelayAfterTrigger(ns value, Positions pos = {});
/** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Xilinx CTB] /** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Xilinx CTB]
@ -330,11 +330,11 @@ class Detector {
* Only when external trigger used */ * Only when external trigger used */
Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const; Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const;
/** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2][Xilinx CTB] /** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Gotthard2]
* [Gotthard2] only in continuous mode */ * [Gotthard2] only in continuous mode */
Result<ns> getPeriodLeft(Positions pos = {}) const; Result<ns> getPeriodLeft(Positions pos = {}) const;
/** [Gotthard][Jungfrau][Moench][CTB][Mythen3][Xilinx CTB] /** [Gotthard][Jungfrau][Moench][CTB][Mythen3]
* [Gotthard2] only in continuous mode */ * [Gotthard2] only in continuous mode */
Result<ns> getDelayAfterTriggerLeft(Positions pos = {}) const; Result<ns> getDelayAfterTriggerLeft(Positions pos = {}) const;
@ -456,17 +456,16 @@ class Detector {
*/ */
void setHighVoltage(int value, Positions pos = {}); void setHighVoltage(int value, Positions pos = {});
/** [Jungfrau][Moench][Mythen3][Gotthard2][Xilinx Ctb] */ /** [Jungfrau][Moench][Mythen3][Gotthard2] */
Result<bool> getPowerChip(Positions pos = {}) const; Result<bool> getPowerChip(Positions pos = {}) const;
/** [Jungfrau][Moench][Mythen3][Gotthard2][Xilinx Ctb] Power the chip. \n /** [Jungfrau][Moench][Mythen3][Gotthard2] Power the chip. \n
* Default is disabled. \n * Default is disabled. \n
* [Jungfrau][Moench] Default is disabled. Get will return power status. Can * [Jungfrau][Moench] Default is disabled. Get will return power status. Can
* be off if temperature event occured (temperature over temp_threshold with * be off if temperature event occured (temperature over temp_threshold with
* temp_control enabled. Will configure chip (only chip v1.1)\n * temp_control enabled. Will configure chip (only chip v1.1)\n
* [Mythen3][Gotthard2] Default is 1. If module not connected or wrong * [Mythen3][Gotthard2] Default is 1. If module not connected or wrong
* module, powerchip will fail.\n * module, powerchip will fail.
* [Xilinx CTB] Default is 0. Also configures chip if powered on.
*/ */
void setPowerChip(bool on, Positions pos = {}); void setPowerChip(bool on, Positions pos = {});
@ -484,7 +483,7 @@ class Detector {
/** /**
* (Degrees) * (Degrees)
* [Mythen3][Gotthard2][Xilinx Ctb] Options: TEMPERATURE_FPGA * [Mythen3][Gotthard2] Options: TEMPERATURE_FPGA
* [Gotthard] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA \n * [Gotthard] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA \n
* [Jungfrau][Moench] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA \n * [Jungfrau][Moench] Options: TEMPERATURE_ADC, TEMPERATURE_FPGA \n
* [Eiger] Options: TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, * [Eiger] Options: TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE,
@ -658,11 +657,11 @@ class Detector {
Result<std::vector<int64_t>> Result<std::vector<int64_t>>
getRxCurrentFrameIndex(Positions pos = {}) const; getRxCurrentFrameIndex(Positions pos = {}) const;
/** [Eiger][Jungfrau][Moench][CTB][Xilinx CTB] */ /** [Eiger][Jungfrau][Moench][CTB] */
Result<uint64_t> getNextFrameNumber(Positions pos = {}) const; Result<uint64_t> getNextFrameNumber(Positions pos = {}) const;
/** [Eiger][Jungfrau][Moench][CTB][Xilinx CTB] Stopping acquisition might /** [Eiger][Jungfrau][Moench][CTB] Stopping acquisition might result in
* result in different frame numbers for different modules.*/ * different frame numbers for different modules.*/
void setNextFrameNumber(uint64_t value, Positions pos = {}); void setNextFrameNumber(uint64_t value, Positions pos = {});
/** [Eiger][Mythen3][Jungfrau][Moench] Sends an internal software trigger to /** [Eiger][Mythen3][Jungfrau][Moench] Sends an internal software trigger to
@ -1608,7 +1607,7 @@ class Detector {
///@{ ///@{
/************************************************** /**************************************************
* * * *
* CTB / Xilinx CTB Specific * * CTB Specific *
* * * *
* ************************************************/ * ************************************************/
/** [CTB] */ /** [CTB] */
@ -1638,12 +1637,12 @@ class Detector {
/** gets list of slow adc enums */ /** gets list of slow adc enums */
std::vector<defs::dacIndex> getSlowADCList() const; std::vector<defs::dacIndex> getSlowADCList() const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
Result<int> getPower(defs::dacIndex index, Positions pos = {}) const; Result<int> getPower(defs::dacIndex index, Positions pos = {}) const;
/** /**
* [CTB][Xilinx CTB] mV * [CTB] mV
* [Ctb][Xilinx CTB] Options: V_LIMIT, V_POWER_A, V_POWER_B, V_POWER_C, * [Ctb] Options: V_LIMIT, V_POWER_A, V_POWER_B, V_POWER_C,
* V_POWER_D, V_POWER_IO, V_POWER_CHIP * V_POWER_D, V_POWER_IO, V_POWER_CHIP
*/ */
void setPower(defs::dacIndex index, int value, Positions pos = {}); void setPower(defs::dacIndex index, int value, Positions pos = {});
@ -1669,30 +1668,39 @@ class Detector {
"complete 4 bits are enabled */ "complete 4 bits are enabled */
void setTenGigaADCEnableMask(uint32_t mask, Positions pos = {}); void setTenGigaADCEnableMask(uint32_t mask, Positions pos = {});
/** [CTB][Xilinx CTB] */ /** [CTB] */
Result<uint32_t> getTransceiverEnableMask(Positions pos = {}) const; Result<uint32_t> getTransceiverEnableMask(Positions pos = {}) const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setTransceiverEnableMask(uint32_t mask, Positions pos = {}); void setTransceiverEnableMask(uint32_t mask, Positions pos = {});
///@}
/** @name CTB Specific */
///@{
/**************************************************
* *
* CTB Specific *
* *
* ************************************************/
/** [CTB] */ /** [CTB] */
Result<int> getNumberOfDigitalSamples(Positions pos = {}) const; Result<int> getNumberOfDigitalSamples(Positions pos = {}) const;
/** [CTB] */ /** [CTB] */
void setNumberOfDigitalSamples(int value, Positions pos = {}); void setNumberOfDigitalSamples(int value, Positions pos = {});
/** [CTB][Xilinx CTB] */ /** [CTB] */
Result<int> getNumberOfTransceiverSamples(Positions pos = {}) const; Result<int> getNumberOfTransceiverSamples(Positions pos = {}) const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setNumberOfTransceiverSamples(int value, Positions pos = {}); void setNumberOfTransceiverSamples(int value, Positions pos = {});
/** [CTB][Xilinx CTB] */ /** [CTB] */
Result<defs::readoutMode> getReadoutMode(Positions pos = {}) const; Result<defs::readoutMode> getReadoutMode(Positions pos = {}) const;
/** [CTB] Options: ANALOG_ONLY (default), DIGITAL_ONLY, ANALOG_AND_DIGITAL, /** [CTB] Options: ANALOG_ONLY (default), DIGITAL_ONLY, ANALOG_AND_DIGITAL,
* TRANSCEIVER_ONLY, DIGITAL_AND_TRANSCEIVER * TRANSCEIVER_ONLY, DIGITAL_AND_TRANSCEIVER
* [Xilinx CTB] Options: TRANSCEIVER_ONLY (default)
*/ */
void setReadoutMode(defs::readoutMode value, Positions pos = {}); void setReadoutMode(defs::readoutMode value, Positions pos = {});
@ -1714,7 +1722,7 @@ class Detector {
Result<int> getMeasuredCurrent(defs::dacIndex index, Result<int> getMeasuredCurrent(defs::dacIndex index,
Positions pos = {}) const; Positions pos = {}) const;
/** [CTB][Xilinx CTB] Options: SLOW_ADC0 - SLOW_ADC7 in uV */ /** [CTB] Options: SLOW_ADC0 - SLOW_ADC7 in uV */
Result<int> getSlowADC(defs::dacIndex index, Positions pos = {}) const; Result<int> getSlowADC(defs::dacIndex index, Positions pos = {}) const;
/** [CTB] */ /** [CTB] */
@ -1756,95 +1764,81 @@ class Detector {
/** [CTB] Default is enabled. */ /** [CTB] Default is enabled. */
void setLEDEnable(bool enable, Positions pos = {}); void setLEDEnable(bool enable, Positions pos = {});
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setDacNames(const std::vector<std::string> names); void setDacNames(const std::vector<std::string> names);
/** [CTB][Xilinx CTB] */
std::vector<std::string> getDacNames() const; std::vector<std::string> getDacNames() const;
/** [CTB][Xilinx CTB] */
defs::dacIndex getDacIndex(const std::string &name) const; defs::dacIndex getDacIndex(const std::string &name) const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setDacName(const defs::dacIndex i, const std::string &name); void setDacName(const defs::dacIndex i, const std::string &name);
/** [CTB][Xilinx CTB] */ /** [CTB] */
std::string getDacName(const defs::dacIndex i) const; std::string getDacName(const defs::dacIndex i) const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setAdcNames(const std::vector<std::string> names); void setAdcNames(const std::vector<std::string> names);
/** [CTB][Xilinx CTB] */ /** [CTB] */
std::vector<std::string> getAdcNames() const; std::vector<std::string> getAdcNames() const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
int getAdcIndex(const std::string &name) const; int getAdcIndex(const std::string &name) const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setAdcName(const int i, const std::string &name); void setAdcName(const int i, const std::string &name);
/** [CTB][Xilinx CTB] */ /** [CTB] */
std::string getAdcName(const int i) const; std::string getAdcName(const int i) const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setSignalNames(const std::vector<std::string> names); void setSignalNames(const std::vector<std::string> names);
/** [CTB][Xilinx CTB] */ /** [CTB] */
std::vector<std::string> getSignalNames() const; std::vector<std::string> getSignalNames() const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
int getSignalIndex(const std::string &name) const; int getSignalIndex(const std::string &name) const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setSignalName(const int i, const std::string &name); void setSignalName(const int i, const std::string &name);
/** [CTB][Xilinx CTB] */ /** [CTB] */
std::string getSignalName(const int i) const; std::string getSignalName(const int i) const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setPowerNames(const std::vector<std::string> names); void setPowerNames(const std::vector<std::string> names);
/** [CTB][Xilinx CTB] */ /** [CTB] */
std::vector<std::string> getPowerNames() const; std::vector<std::string> getPowerNames() const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
defs::dacIndex getPowerIndex(const std::string &name) const; defs::dacIndex getPowerIndex(const std::string &name) const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setPowerName(const defs::dacIndex i, const std::string &name); void setPowerName(const defs::dacIndex i, const std::string &name);
/** [CTB][Xilinx CTB] */ /** [CTB] */
std::string getPowerName(const defs::dacIndex i) const; std::string getPowerName(const defs::dacIndex i) const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setSlowADCNames(const std::vector<std::string> names); void setSlowADCNames(const std::vector<std::string> names);
/** [CTB][Xilinx CTB] */ /** [CTB] */
std::vector<std::string> getSlowADCNames() const; std::vector<std::string> getSlowADCNames() const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
defs::dacIndex getSlowADCIndex(const std::string &name) const; defs::dacIndex getSlowADCIndex(const std::string &name) const;
/** [CTB][Xilinx CTB] */ /** [CTB] */
void setSlowADCName(const defs::dacIndex i, const std::string &name); void setSlowADCName(const defs::dacIndex i, const std::string &name);
/** [CTB][Xilinx CTB] */ /** [CTB] */
std::string getSlowADCName(const defs::dacIndex i) const; std::string getSlowADCName(const defs::dacIndex i) const;
///@} ///@}
/** @name Xilinx CTB Specific */
///@{
/**************************************************
* *
* Xilinx CTB Specific *
* *
* ************************************************/
///@}
/** [Xilinx Ctb] */
void configureTransceiver(Positions pos = {});
/** @name Pattern */ /** @name Pattern */
///@{ ///@{
/************************************************** /**************************************************
@ -1992,7 +1986,7 @@ class Detector {
void programFPGA(const std::string &fname, const bool forceDeleteNormalFile, void programFPGA(const std::string &fname, const bool forceDeleteNormalFile,
Positions pos = {}); Positions pos = {});
/** [Jungfrau][Moench][CTB][Xilinx CTB] Advanced user Function! */ /** [Jungfrau][Moench][CTB] Advanced user Function! */
void resetFPGA(Positions pos = {}); void resetFPGA(Positions pos = {});
/** [Jungfrau][Moench][Eiger][Ctb][Mythen3][Gotthard2] Copies detector /** [Jungfrau][Moench][Eiger][Ctb][Mythen3][Gotthard2] Copies detector
@ -2010,8 +2004,8 @@ class Detector {
*/ */
void updateKernel(const std::string &fname, Positions pos = {}); void updateKernel(const std::string &fname, Positions pos = {});
/** [Jungfrau][Moench][Gotthard][CTB][Mythen3][Gotthard2][Xilinx CTB] /** [Jungfrau][Moench][Gotthard][CTB][Mythen3][Gotthard2] Advanced user
* Advanced user Function! */ * Function! */
void rebootController(Positions pos = {}); void rebootController(Positions pos = {});
/** /**
@ -2115,16 +2109,16 @@ class Detector {
Result<std::string> executeCommand(const std::string &value, Result<std::string> executeCommand(const std::string &value,
Positions pos = {}); Positions pos = {});
/** [Jungfrau][Moench][Mythen3][CTB][Xilinx CTB] /** [Jungfrau][Moench][Mythen3][CTB]
* [Gotthard2] only in continuous mode */ * [Gotthard2] only in continuous mode */
Result<int64_t> getNumberOfFramesFromStart(Positions pos = {}) const; Result<int64_t> getNumberOfFramesFromStart(Positions pos = {}) const;
/** [Jungfrau][Moench][Mythen3][CTB][Xilinx CTB] Get time from detector /** [Jungfrau][Moench][Mythen3][CTB] Get time from detector start
* start [Gotthard2] not in burst and auto mode */ * [Gotthard2] not in burst and auto mode */
Result<ns> getActualTime(Positions pos = {}) const; Result<ns> getActualTime(Positions pos = {}) const;
/** [Jungfrau][Moench][Mythen3][CTB][Xilinx CTB] Get timestamp at a frame /** [Jungfrau][Moench][Mythen3][CTB] Get timestamp at a frame start
* start [Gotthard2] not in burst and auto mode */ * [Gotthard2] not in burst and auto mode */
Result<ns> getMeasurementTime(Positions pos = {}) const; Result<ns> getMeasurementTime(Positions pos = {}) const;
/** get user details from shared memory (hostname, type, PID, User, Date) /** get user details from shared memory (hostname, type, PID, User, Date)

View File

@ -2247,46 +2247,6 @@ std::string Caller::config(int action) {
return os.str(); return os.str();
} }
std::string Caller::configtransceiver(int action) {
std::ostringstream os;
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: configtransceiver" << std::endl;
os << R"V0G0N(
[Xilinx Ctb] Waits for transceiver to be aligned. Chip had to be configured (powered on) before this. )V0G0N"
<< std::endl;
return os.str();
}
// check if action and arguments are valid
if (action == slsDetectorDefs::PUT_ACTION) {
if (1 && args.size() != 0) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
if (args.size() == 0) {
}
}
else {
throw RuntimeError(
"INTERNAL ERROR: Invalid action: supported actions are ['PUT']");
}
// generate code for each action
if (action == slsDetectorDefs::PUT_ACTION) {
if (args.size() == 0) {
det->configureTransceiver(std::vector<int>{det_id});
os << "successful" << '\n';
}
}
return os.str();
}
std::string Caller::dac(int action) { std::string Caller::dac(int action) {
std::ostringstream os; std::ostringstream os;
@ -3201,7 +3161,7 @@ std::string Caller::delay(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: delay" << std::endl; os << "Command: delay" << std::endl;
os << R"V0G0N([duration] [(optional unit) ns|us|ms|s] os << R"V0G0N([duration] [(optional unit) ns|us|ms|s]
[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Moench][Xilinx Ctb] Delay after trigger )V0G0N" [Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Moench] Delay after trigger )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -3290,7 +3250,7 @@ std::string Caller::delayl(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: delayl" << std::endl; os << "Command: delayl" << std::endl;
os << R"V0G0N( os << R"V0G0N(
[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Delay Left in Acquisition. [Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Delay Left in Acquisition.
[Gotthard2] only in continuous mode. )V0G0N" [Gotthard2] only in continuous mode. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
@ -3725,7 +3685,7 @@ std::string Caller::exptime(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: exptime" << std::endl; os << "Command: exptime" << std::endl;
os << R"V0G0N([duration] [(optional unit) ns|us|ms|s] os << R"V0G0N([duration] [(optional unit) ns|us|ms|s]
[Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Ctb][Xilinx Ctb] Exposure time [Eiger][Jungfrau][Moench][Gotthard][Gotthard2][Ctb] Exposure time
[Mythen3] Exposure time of all gate signals in auto and trigger mode (internal gating). To specify gate index, use exptime1, exptime2, exptime3. )V0G0N" [Mythen3] Exposure time of all gate signals in auto and trigger mode (internal gating). To specify gate index, use exptime1, exptime2, exptime3. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
@ -4706,7 +4666,7 @@ std::string Caller::firmwaretest(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: firmwaretest" << std::endl; os << "Command: firmwaretest" << std::endl;
os << R"V0G0N( os << R"V0G0N(
[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Firmware test, ie. reads a read fixed pattern from a register. )V0G0N" [Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb] Firmware test, ie. reads a read fixed pattern from a register. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -5172,7 +5132,7 @@ std::string Caller::framecounter(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: framecounter" << std::endl; os << "Command: framecounter" << std::endl;
os << R"V0G0N( os << R"V0G0N(
[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Number of frames from start run control. [Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Number of frames from start run control.
[Gotthard2] only in continuous mode. )V0G0N" [Gotthard2] only in continuous mode. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
@ -5323,7 +5283,7 @@ std::string Caller::frametime(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: frametime" << std::endl; os << "Command: frametime" << std::endl;
os << R"V0G0N([(optional unit) ns|us|ms|s] os << R"V0G0N([(optional unit) ns|us|ms|s]
[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Timestamp at a frame start. [Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Timestamp at a frame start.
[Gotthard2] not in burst and auto mode. )V0G0N" [Gotthard2] not in burst and auto mode. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
@ -7264,7 +7224,7 @@ std::string Caller::nextframenumber(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: nextframenumber" << std::endl; os << "Command: nextframenumber" << std::endl;
os << R"V0G0N([n_value] os << R"V0G0N([n_value]
[Eiger][Jungfrau][Moench][Ctb][Xilinx Ctb] Next frame number. Stopping acquisition might result in different frame numbers for different modules. )V0G0N" [Eiger][Jungfrau][Moench][Ctb] Next frame number. Stopping acquisition might result in different frame numbers for different modules. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -9181,7 +9141,7 @@ std::string Caller::periodl(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: periodl" << std::endl; os << "Command: periodl" << std::endl;
os << R"V0G0N( os << R"V0G0N(
[Gotthard][Jungfrau][Moench][Ctb][Mythen3][Gotthard2][Xilinx Ctb] Period left for current frame. [Gotthard][Jungfrau][Moench][Ctb][Mythen3][Gotthard2] Period left for current frame.
[Gotthard2] only in continuous mode. )V0G0N" [Gotthard2] only in continuous mode. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
@ -9357,10 +9317,9 @@ std::string Caller::powerchip(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: powerchip" << std::endl; os << "Command: powerchip" << std::endl;
os << R"V0G0N([0, 1] os << R"V0G0N([0, 1]
[Jungfrau][Moench][Mythen3][Gotthard2][Xilinx Ctb] Power the chip. [Jungfrau][Moench][Mythen3][Gotthard2] Power the chip.
[Jungfrau][Moench] Default is 0. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1) [Jungfrau][Moench] Default is 0. Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled. Will configure chip (only chip v1.1)
[Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail. [Mythen3][Gotthard2] Default is 1. If module not connected or wrong module, powerchip will fail. )V0G0N"
[Xilinx Ctb] Default is 0. Also configures the chip if powered on. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -10271,7 +10230,7 @@ std::string Caller::rebootcontroller(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: rebootcontroller" << std::endl; os << "Command: rebootcontroller" << std::endl;
os << R"V0G0N( os << R"V0G0N(
[Jungfrau][Moench][Ctb][Gotthard][Mythen3][Gotthard2][Xilinx Ctb] Reboot controller of detector. )V0G0N" [Jungfrau][Moench][Ctb][Gotthard][Mythen3][Gotthard2] Reboot controller of detector. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -10440,7 +10399,7 @@ std::string Caller::resetfpga(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: resetfpga" << std::endl; os << "Command: resetfpga" << std::endl;
os << R"V0G0N( os << R"V0G0N(
[Jungfrau][Moench][Ctb][Xilinx Ctb] Reset FPGA. )V0G0N" [Jungfrau][Moench][Ctb] Reset FPGA. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -10546,7 +10505,7 @@ std::string Caller::romode(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: romode" << std::endl; os << "Command: romode" << std::endl;
os << R"V0G0N([analog|digital|analog_digital|transceiver|digital_transceiver] os << R"V0G0N([analog|digital|analog_digital|transceiver|digital_transceiver]
[Ctb][xilinx Ctb] Readout mode. [Ctb] Default is analog. [Xilinx Ctb] Default is Transceiver (only one implemented so far) )V0G0N" [Ctb] Readout mode. Default is analog. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -10737,7 +10696,7 @@ std::string Caller::runtime(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: runtime" << std::endl; os << "Command: runtime" << std::endl;
os << R"V0G0N([(optional unit) ns|us|ms|s] os << R"V0G0N([(optional unit) ns|us|ms|s]
[Jungfrau][Moench][Mythen3][Gotthard2][Ctb][Xilinx Ctb] Time from detector start up. [Jungfrau][Moench][Mythen3][Gotthard2][Ctb] Time from detector start up.
[Gotthard2] not in burst and auto mode. )V0G0N" [Gotthard2] not in burst and auto mode. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
@ -13339,7 +13298,7 @@ std::string Caller::slowadcvalues(int action) {
if (action == slsDetectorDefs::GET_ACTION) { if (action == slsDetectorDefs::GET_ACTION) {
if (args.size() == 0) { if (args.size() == 0) {
std::string suffix = " uV"; std::string suffix = " mV";
auto t = det->getSlowADCList(); auto t = det->getSlowADCList();
auto names = det->getSlowADCNames(); auto names = det->getSlowADCNames();
@ -14256,7 +14215,7 @@ std::string Caller::temp_fpga(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: temp_fpga" << std::endl; os << "Command: temp_fpga" << std::endl;
os << R"V0G0N([n_value] os << R"V0G0N([n_value]
[Eiger][Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Xilinx CTB] FPGA Temperature )V0G0N" [Eiger][Jungfrau][Moench][Gotthard][Mythen3][Gotthard2] FPGA Temperature )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -15001,7 +14960,7 @@ std::string Caller::transceiverenable(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: transceiverenable" << std::endl; os << "Command: transceiverenable" << std::endl;
os << R"V0G0N([bitmask] os << R"V0G0N([bitmask]
[Ctb][Xilinx Ctb] Transceiver Enable Mask. Enable for each 4 Transceiver channel. )V0G0N" [Ctb] Transceiver Enable Mask. Enable for each 4 Transceiver channel. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -15335,7 +15294,7 @@ std::string Caller::tsamples(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: tsamples" << std::endl; os << "Command: tsamples" << std::endl;
os << R"V0G0N([n_value] os << R"V0G0N([n_value]
[Ctb][Xilinx Ctb] Number of transceiver samples expected. )V0G0N" [Ctb] Number of transceiver samples expected. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -16609,7 +16568,7 @@ std::string Caller::v_a(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: v_a" << std::endl; os << "Command: v_a" << std::endl;
os << R"V0G0N([n_value] os << R"V0G0N([n_value]
[Ctb][Xilinx Ctb] Power supply a in mV. )V0G0N" [Ctb] Power supply a in mV. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -16672,7 +16631,7 @@ std::string Caller::v_b(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: v_b" << std::endl; os << "Command: v_b" << std::endl;
os << R"V0G0N([n_value] os << R"V0G0N([n_value]
[Ctb][Xilinx Ctb] Power supply b in mV. )V0G0N" [Ctb] Power supply b in mV. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -16735,7 +16694,7 @@ std::string Caller::v_c(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: v_c" << std::endl; os << "Command: v_c" << std::endl;
os << R"V0G0N([n_value] os << R"V0G0N([n_value]
[Ctb][Xilinx Ctb] Power supply c in mV. )V0G0N" [Ctb] Power supply c in mV. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -16862,7 +16821,7 @@ std::string Caller::v_d(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: v_d" << std::endl; os << "Command: v_d" << std::endl;
os << R"V0G0N([n_value] os << R"V0G0N([n_value]
[Ctb][Xilinx Ctb] Power supply d in mV. )V0G0N" [Ctb] Power supply d in mV. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -16925,7 +16884,7 @@ std::string Caller::v_io(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: v_io" << std::endl; os << "Command: v_io" << std::endl;
os << R"V0G0N([n_value] os << R"V0G0N([n_value]
[Ctb][Xilinx Ctb] Power supply io in mV. Minimum 1200 mV. Must be the first power regulator to be set after fpga reset (on-board detector server start up). )V0G0N" [Ctb] Power supply io in mV. Minimum 1200 mV. Must be the first power regulator to be set after fpga reset (on-board detector server start up). )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }
@ -16988,7 +16947,7 @@ std::string Caller::v_limit(int action) {
if (action == slsDetectorDefs::HELP_ACTION) { if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: v_limit" << std::endl; os << "Command: v_limit" << std::endl;
os << R"V0G0N([n_value] os << R"V0G0N([n_value]
[Ctb][Xilinx Ctb] Soft limit for power supplies (ctb only) and DACS in mV. )V0G0N" [Ctb] Soft limit for power supplies (ctb only) and DACS in mV. )V0G0N"
<< std::endl; << std::endl;
return os.str(); return os.str();
} }

View File

@ -93,7 +93,6 @@ class Caller {
std::string compdisabletime(int action); std::string compdisabletime(int action);
std::string confadc(int action); std::string confadc(int action);
std::string config(int action); std::string config(int action);
std::string configtransceiver(int action);
std::string counters(int action); std::string counters(int action);
std::string currentsource(int action); std::string currentsource(int action);
std::string dac(int action); std::string dac(int action);
@ -436,7 +435,6 @@ class Caller {
{"compdisabletime", &Caller::compdisabletime}, {"compdisabletime", &Caller::compdisabletime},
{"confadc", &Caller::confadc}, {"confadc", &Caller::confadc},
{"config", &Caller::config}, {"config", &Caller::config},
{"configtransceiver", &Caller::configtransceiver},
{"counters", &Caller::counters}, {"counters", &Caller::counters},
{"currentsource", &Caller::currentsource}, {"currentsource", &Caller::currentsource},
{"dac", &Caller::dac}, {"dac", &Caller::dac},

View File

@ -232,6 +232,7 @@ std::string Caller::acquire(int action) {
if (det_id >= 0) { if (det_id >= 0) {
throw RuntimeError("Individual detectors not allowed for readout."); throw RuntimeError("Individual detectors not allowed for readout.");
} }
det->acquire(); det->acquire();
if (det->getUseReceiverFlag().squash(false)) { if (det->getUseReceiverFlag().squash(false)) {

View File

@ -667,7 +667,6 @@ std::vector<defs::dacIndex> Detector::getTemperatureList() const {
defs::TEMPERATURE_FPGA2, defs::TEMPERATURE_FPGA3}; defs::TEMPERATURE_FPGA2, defs::TEMPERATURE_FPGA3};
case defs::MYTHEN3: case defs::MYTHEN3:
case defs::GOTTHARD2: case defs::GOTTHARD2:
case defs::XILINX_CHIPTESTBOARD:
return std::vector<defs::dacIndex>{defs::TEMPERATURE_FPGA}; return std::vector<defs::dacIndex>{defs::TEMPERATURE_FPGA};
default: default:
return std::vector<defs::dacIndex>{}; return std::vector<defs::dacIndex>{};
@ -698,7 +697,6 @@ Result<int> Detector::getTemperature(defs::dacIndex index,
case defs::MOENCH: case defs::MOENCH:
case defs::MYTHEN3: case defs::MYTHEN3:
case defs::GOTTHARD2: case defs::GOTTHARD2:
case defs::XILINX_CHIPTESTBOARD:
for (auto &it : res) { for (auto &it : res) {
it /= 1000; it /= 1000;
} }
@ -2488,12 +2486,6 @@ std::string Detector::getSlowADCName(const defs::dacIndex i) const {
return pimpl->getCtbSlowADCName(i); return pimpl->getCtbSlowADCName(i);
} }
// Xilinx Ctb Specific
void Detector::configureTransceiver(Positions pos) {
pimpl->Parallel(&Module::configureTransceiver, pos);
}
// Pattern // Pattern
Result<std::string> Detector::getPatterFileName(Positions pos) const { Result<std::string> Detector::getPatterFileName(Positions pos) const {

View File

@ -1375,7 +1375,7 @@ void DetectorImpl::stopDetector(Positions pos) {
void DetectorImpl::printProgress(double progress) { void DetectorImpl::printProgress(double progress) {
// spaces for python printout // spaces for python printout
std::cout << " " << std::fixed << std::setprecision(2) << std::setw(10) std::cout << " " << std::fixed << std::setprecision(2) << std::setw(6)
<< progress << " \%"; << progress << " \%";
std::cout << '\r' << std::flush; std::cout << '\r' << std::flush;
} }

View File

@ -2383,7 +2383,6 @@ void Module::setNumberOfAnalogSamples(int value) {
// update #nchan, as it depends on #samples, adcmask // update #nchan, as it depends on #samples, adcmask
updateNumberOfChannels(); updateNumberOfChannels();
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
LOG(logINFORED) << "receiver up!";
sendToReceiver(F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value, nullptr); sendToReceiver(F_RECEIVER_SET_NUM_ANALOG_SAMPLES, value, nullptr);
} }
} }
@ -2532,13 +2531,6 @@ void Module::setLEDEnable(bool enable) {
sendToDetector<int>(F_LED, static_cast<int>(enable)); sendToDetector<int>(F_LED, static_cast<int>(enable));
} }
// Xilinx Ctb Specific
void Module::configureTransceiver() {
sendToDetector(F_CONFIG_TRANSCEIVER);
LOG(logINFO) << "Module " << moduleIndex << " (" << shm()->hostname
<< "): Transceiver configured successfully!";
}
// Pattern // Pattern
std::string Module::getPatterFileName() const { std::string Module::getPatterFileName() const {
char retval[MAX_STR_LENGTH]{}; char retval[MAX_STR_LENGTH]{};
@ -3342,13 +3334,7 @@ void Module::initializeModuleStructure(detectorType type) {
shm()->numberOfModule.y = 0; shm()->numberOfModule.y = 0;
shm()->controlPort = DEFAULT_TCP_CNTRL_PORTNO; shm()->controlPort = DEFAULT_TCP_CNTRL_PORTNO;
shm()->stopPort = DEFAULT_TCP_STOP_PORTNO; shm()->stopPort = DEFAULT_TCP_STOP_PORTNO;
char *home_directory = getenv("HOME"); strcpy_safe(shm()->settingsDir, getenv("HOME"));
if (home_directory != nullptr)
strcpy_safe(shm()->settingsDir, home_directory);
else {
strcpy_safe(shm()->settingsDir, "");
LOG(logWARNING) << "HOME directory not set";
}
strcpy_safe(shm()->rxHostname, "none"); strcpy_safe(shm()->rxHostname, "none");
shm()->rxTCPPort = DEFAULT_TCP_RX_PORTNO + moduleIndex; shm()->rxTCPPort = DEFAULT_TCP_RX_PORTNO + moduleIndex;
shm()->useReceiverFlag = false; shm()->useReceiverFlag = false;

View File

@ -528,13 +528,6 @@ class Module : public virtual slsDetectorDefs {
bool getLEDEnable() const; bool getLEDEnable() const;
void setLEDEnable(bool enable); void setLEDEnable(bool enable);
/**************************************************
* *
* Xilinx Ctb Specific *
* *
* ************************************************/
void configureTransceiver();
/************************************************** /**************************************************
* * * *
* Pattern * * Pattern *

View File

@ -562,18 +562,6 @@ int InferAction::config() {
} }
} }
int InferAction::configtransceiver() {
if (args.size() == 0) {
return slsDetectorDefs::PUT_ACTION;
}
else {
throw RuntimeError("Could not infer action: Wrong number of arguments");
}
}
int InferAction::counters() { int InferAction::counters() {
throw RuntimeError("sls_detector is disabled for command: counters. Use " throw RuntimeError("sls_detector is disabled for command: counters. Use "

View File

@ -48,7 +48,6 @@ class InferAction {
int compdisabletime(); int compdisabletime();
int confadc(); int confadc();
int config(); int config();
int configtransceiver();
int counters(); int counters();
int currentsource(); int currentsource();
int dac(); int dac();
@ -382,7 +381,6 @@ class InferAction {
{"compdisabletime", &InferAction::compdisabletime}, {"compdisabletime", &InferAction::compdisabletime},
{"confadc", &InferAction::confadc}, {"confadc", &InferAction::confadc},
{"config", &InferAction::config}, {"config", &InferAction::config},
{"configtransceiver", &InferAction::configtransceiver},
{"counters", &InferAction::counters}, {"counters", &InferAction::counters},
{"currentsource", &InferAction::currentsource}, {"currentsource", &InferAction::currentsource},
{"dac", &InferAction::dac}, {"dac", &InferAction::dac},

View File

@ -15,7 +15,6 @@ target_sources(tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-gotthard2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-gotthard2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-gotthard.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-gotthard.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-chiptestboard.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-chiptestboard.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-xilinx-chiptestboard.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-moench.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-moench.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-global.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Caller/test-Caller-global.cpp

View File

@ -368,8 +368,7 @@ TEST_CASE("CALLER::powervalues", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
REQUIRE_NOTHROW(caller.call("powervalues", {}, -1, GET)); REQUIRE_NOTHROW(caller.call("powervalues", {}, -1, GET));
REQUIRE_THROWS(caller.call("powervalues", {}, -1, PUT)); REQUIRE_THROWS(caller.call("powervalues", {}, -1, PUT));
} else { } else {
@ -381,8 +380,7 @@ TEST_CASE("CALLER::slowadcvalues", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
REQUIRE_NOTHROW(caller.call("slowadcvalues", {}, -1, GET)); REQUIRE_NOTHROW(caller.call("slowadcvalues", {}, -1, GET));
REQUIRE_THROWS(caller.call("slowadcvalues", {}, -1, PUT)); REQUIRE_THROWS(caller.call("slowadcvalues", {}, -1, PUT));
} else { } else {
@ -498,7 +496,12 @@ TEST_CASE("CALLER::dac", "[.cmdcall][.dacs]") {
det_type == defs::XILINX_CHIPTESTBOARD) { det_type == defs::XILINX_CHIPTESTBOARD) {
for (int i = 0; i < 18; ++i) { for (int i = 0; i < 18; ++i) {
SECTION("dac " + std::to_string(i)) { SECTION("dac " + std::to_string(i)) {
if (det_type == defs::CHIPTESTBOARD) {
test_dac_caller(static_cast<defs::dacIndex>(i), "dac", 0); test_dac_caller(static_cast<defs::dacIndex>(i), "dac", 0);
} else {
REQUIRE_THROWS(
caller.call("dac", {std::to_string(i)}, -1, GET));
}
} }
} }
@ -610,10 +613,12 @@ TEST_CASE("CALLER::samples", "[.cmdcall]") {
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_asamples = det.getNumberOfAnalogSamples(); auto prev_asamples = det.getNumberOfAnalogSamples();
auto prev_dsamples = det.getNumberOfDigitalSamples(); Result<int> prev_dsamples = 0;
if (det_type == defs::CHIPTESTBOARD) {
prev_dsamples = det.getNumberOfDigitalSamples();
}
{ {
std::ostringstream oss; std::ostringstream oss;
caller.call("samples", {"25"}, -1, PUT, oss); caller.call("samples", {"25"}, -1, PUT, oss);
@ -634,16 +639,17 @@ TEST_CASE("CALLER::samples", "[.cmdcall]") {
caller.call("asamples", {}, -1, GET, oss); caller.call("asamples", {}, -1, GET, oss);
REQUIRE(oss.str() == "asamples 450\n"); REQUIRE(oss.str() == "asamples 450\n");
} }
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
std::ostringstream oss; std::ostringstream oss;
caller.call("dsamples", {}, -1, GET, oss); caller.call("dsamples", {}, -1, GET, oss);
REQUIRE(oss.str() == "dsamples 450\n"); REQUIRE(oss.str() == "dsamples 450\n");
} }
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setNumberOfAnalogSamples(prev_asamples[i], {i}); det.setNumberOfAnalogSamples(prev_asamples[i], {i});
if (det_type == defs::CHIPTESTBOARD) {
det.setNumberOfDigitalSamples(prev_dsamples[i], {i}); det.setNumberOfDigitalSamples(prev_dsamples[i], {i});
} }
}
} else { } else {
REQUIRE_THROWS(caller.call("samples", {}, -1, GET)); REQUIRE_THROWS(caller.call("samples", {}, -1, GET));
} }
@ -654,8 +660,7 @@ TEST_CASE("CALLER::asamples", "[.cmdcall]") {
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getNumberOfAnalogSamples(); auto prev_val = det.getNumberOfAnalogSamples();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -759,8 +764,7 @@ TEST_CASE("CALLER::v_limit", "[.cmdcall]") {
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPower(defs::V_LIMIT); auto prev_val = det.getPower(defs::V_LIMIT);
{ {
std::ostringstream oss; std::ostringstream oss;
@ -828,8 +832,7 @@ TEST_CASE("CALLER::adcenable10g", "[.cmdcall]") {
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getTenGigaADCEnableMask(); auto prev_val = det.getTenGigaADCEnableMask();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -859,8 +862,7 @@ TEST_CASE("CALLER::transceiverenable", "[.cmdcall]") {
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getTransceiverEnableMask(); auto prev_val = det.getTransceiverEnableMask();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -892,8 +894,7 @@ TEST_CASE("CALLER::dsamples", "[.cmdcall]") {
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getNumberOfDigitalSamples(); auto prev_val = det.getNumberOfDigitalSamples();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -923,8 +924,7 @@ TEST_CASE("CALLER::tsamples", "[.cmdcall]") {
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getNumberOfTransceiverSamples(); auto prev_val = det.getNumberOfTransceiverSamples();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -953,8 +953,7 @@ TEST_CASE("CALLER::romode", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_romode = det.getReadoutMode(); auto prev_romode = det.getReadoutMode();
auto prev_asamples = det.getNumberOfAnalogSamples(); auto prev_asamples = det.getNumberOfAnalogSamples();
auto prev_dsamples = det.getNumberOfDigitalSamples(); auto prev_dsamples = det.getNumberOfDigitalSamples();
@ -1038,8 +1037,7 @@ TEST_CASE("CALLER::v_a", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPower(defs::V_POWER_A); auto prev_val = det.getPower(defs::V_POWER_A);
{ {
std::ostringstream oss1, oss2; std::ostringstream oss1, oss2;
@ -1060,8 +1058,7 @@ TEST_CASE("CALLER::v_b", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPower(defs::V_POWER_B); auto prev_val = det.getPower(defs::V_POWER_B);
{ {
std::ostringstream oss1, oss2; std::ostringstream oss1, oss2;
@ -1082,8 +1079,7 @@ TEST_CASE("CALLER::v_c", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPower(defs::V_POWER_C); auto prev_val = det.getPower(defs::V_POWER_C);
{ {
std::ostringstream oss1, oss2; std::ostringstream oss1, oss2;
@ -1104,8 +1100,7 @@ TEST_CASE("CALLER::v_d", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPower(defs::V_POWER_D); auto prev_val = det.getPower(defs::V_POWER_D);
{ {
std::ostringstream oss1, oss2; std::ostringstream oss1, oss2;
@ -1126,8 +1121,7 @@ TEST_CASE("CALLER::v_io", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
// better not to play with setting it // better not to play with setting it
REQUIRE_NOTHROW(caller.call("v_io", {}, -1, GET)); REQUIRE_NOTHROW(caller.call("v_io", {}, -1, GET));
} else { } else {
@ -1257,12 +1251,11 @@ TEST_CASE("CALLER::im_io", "[.cmdcall]") {
} }
} }
TEST_CASE("CALLER::slowadc", "[.cmdcall]") { TEST_CASE("CALLER::adc", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
for (int i = 0; i <= 7; ++i) { for (int i = 0; i <= 7; ++i) {
REQUIRE_NOTHROW( REQUIRE_NOTHROW(
caller.call("slowadc", {std::to_string(i)}, -1, GET)); caller.call("slowadc", {std::to_string(i)}, -1, GET));

View File

@ -81,10 +81,9 @@ TEST_CASE("Caller::patioctrl", "[.cmdcall]") {
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD ||
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPatternIOControl();
if (det_type == defs::CHIPTESTBOARD) { if (det_type == defs::CHIPTESTBOARD) {
auto prev_val = det.getPatternIOControl();
{
std::ostringstream oss; std::ostringstream oss;
caller.call("patioctrl", {"0xc15004808d0a21a4"}, -1, PUT, oss); caller.call("patioctrl", {"0xc15004808d0a21a4"}, -1, PUT, oss);
REQUIRE(oss.str() == "patioctrl 0xc15004808d0a21a4\n"); REQUIRE(oss.str() == "patioctrl 0xc15004808d0a21a4\n");

View File

@ -27,6 +27,8 @@ python/scripts/list_tested_cmd.py to check if all commands are covered
TEST_CASE("Caller::rx_version", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_version", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
std::ostringstream oss; std::ostringstream oss;
caller.call("rx_version", {}, -1, GET, oss); caller.call("rx_version", {}, -1, GET, oss);
sls::Version v(APIRECEIVER); sls::Version v(APIRECEIVER);
@ -35,12 +37,17 @@ TEST_CASE("Caller::rx_version", "[.cmdcall][.rx]") {
REQUIRE(oss.str() == vs.str()); REQUIRE(oss.str() == vs.str());
REQUIRE_THROWS(caller.call("rx_version", {"0"}, -1, PUT)); REQUIRE_THROWS(caller.call("rx_version", {"0"}, -1, PUT));
} else {
REQUIRE_THROWS(caller.call("rx_version", {}, -1, GET));
}
} }
/* acquisition */ /* acquisition */
TEST_CASE("Caller::rx_start", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_start", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
det.setFileWrite(false); // avoid writing or error on file creation det.setFileWrite(false); // avoid writing or error on file creation
// PUT only command // PUT only command
REQUIRE_THROWS(caller.call("rx_start", {}, -1, GET)); REQUIRE_THROWS(caller.call("rx_start", {}, -1, GET));
@ -54,11 +61,16 @@ TEST_CASE("Caller::rx_start", "[.cmdcall][.rx]") {
caller.call("rx_status", {}, -1, GET, oss); caller.call("rx_status", {}, -1, GET, oss);
REQUIRE(oss.str() == "rx_status running\n"); REQUIRE(oss.str() == "rx_status running\n");
} }
} else {
REQUIRE_THROWS(caller.call("rx_start", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_stop", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_stop", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
// PUT only command // PUT only command
REQUIRE_THROWS(caller.call("rx_stop", {}, -1, GET)); REQUIRE_THROWS(caller.call("rx_stop", {}, -1, GET));
{ {
@ -71,12 +83,18 @@ TEST_CASE("Caller::rx_stop", "[.cmdcall][.rx]") {
caller.call("rx_status", {}, -1, GET, oss); caller.call("rx_status", {}, -1, GET, oss);
REQUIRE(oss.str() == "rx_status idle\n"); REQUIRE(oss.str() == "rx_status idle\n");
} }
} else {
REQUIRE_THROWS(caller.call("rx_stop", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_status", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_status", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
det.setFileWrite(false); // avoid writing or error on file creation det.setFileWrite(false); // avoid writing or error on file creation
Caller caller(&det);
det.startReceiver(); det.startReceiver();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -89,11 +107,16 @@ TEST_CASE("Caller::rx_status", "[.cmdcall][.rx]") {
caller.call("rx_status", {}, -1, GET, oss); caller.call("rx_status", {}, -1, GET, oss);
REQUIRE(oss.str() == "rx_status idle\n"); REQUIRE(oss.str() == "rx_status idle\n");
} }
} else {
REQUIRE_THROWS(caller.call("rx_status", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_framescaught", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_framescaught", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
// This ensures 0 caught frames // This ensures 0 caught frames
auto prev_val = det.getFileWrite(); auto prev_val = det.getFileWrite();
det.setFileWrite(false); // avoid writing or error on file creation det.setFileWrite(false); // avoid writing or error on file creation
@ -123,13 +146,19 @@ TEST_CASE("Caller::rx_framescaught", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setFileWrite(prev_val[i], {i}); det.setFileWrite(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_framescaught", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_missingpackets", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_missingpackets", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getFileWrite(); auto prev_val = det.getFileWrite();
det.setFileWrite(false); // avoid writing or error on file creation det.setFileWrite(false); // avoid writing or error on file creation
Caller caller(&det);
auto prev_frames = auto prev_frames =
det.getNumberOfFrames().tsquash("inconsistent #frames in test"); det.getNumberOfFrames().tsquash("inconsistent #frames in test");
det.setNumberOfFrames(100); det.setNumberOfFrames(100);
@ -147,8 +176,7 @@ TEST_CASE("Caller::rx_missingpackets", "[.cmdcall][.rx]") {
} }
} }
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type != defs::CHIPTESTBOARD && if (det_type != defs::CHIPTESTBOARD && det_type != defs::MOENCH) {
det_type != defs::XILINX_CHIPTESTBOARD) {
// 0 missing packets (takes into account that acquisition is // 0 missing packets (takes into account that acquisition is
// stopped) // stopped)
det.startReceiver(); det.startReceiver();
@ -168,15 +196,23 @@ TEST_CASE("Caller::rx_missingpackets", "[.cmdcall][.rx]") {
det.setFileWrite(prev_val[i], {i}); det.setFileWrite(prev_val[i], {i});
} }
det.setNumberOfFrames(prev_frames); det.setNumberOfFrames(prev_frames);
} else {
REQUIRE_THROWS(caller.call("rx_missingpackets", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_frameindex", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_frameindex", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
caller.call("rx_frameindex", {}, -1, GET); caller.call("rx_frameindex", {}, -1, GET);
// This is a get only command // This is a get only command
REQUIRE_THROWS(caller.call("rx_frameindex", {"2"}, -1, PUT)); REQUIRE_THROWS(caller.call("rx_frameindex", {"2"}, -1, PUT));
} else {
REQUIRE_THROWS(caller.call("rx_frameindex", {}, -1, GET));
}
} }
/* Network Configuration (Detector<->Receiver) */ /* Network Configuration (Detector<->Receiver) */
@ -184,7 +220,12 @@ TEST_CASE("Caller::rx_frameindex", "[.cmdcall][.rx]") {
TEST_CASE("Caller::rx_printconfig", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_printconfig", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
REQUIRE_NOTHROW(caller.call("rx_printconfig", {}, -1, GET)); REQUIRE_NOTHROW(caller.call("rx_printconfig", {}, -1, GET));
} else {
REQUIRE_THROWS(caller.call("rx_printconfig", {}, -1, GET));
}
} }
/* Receiver Config */ /* Receiver Config */
@ -192,6 +233,8 @@ TEST_CASE("Caller::rx_printconfig", "[.cmdcall][.rx]") {
TEST_CASE("Caller::rx_hostname", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_hostname", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxHostname(); auto prev_val = det.getRxHostname();
// Cannot set rx_hostname (will reset parameters in rxr and no shm // Cannot set rx_hostname (will reset parameters in rxr and no shm
@ -219,6 +262,9 @@ TEST_CASE("Caller::rx_hostname", "[.cmdcall][.rx]") {
caller.call("rx_hostname", {}, 0, GET, oss); caller.call("rx_hostname", {}, 0, GET, oss);
REQUIRE(oss.str() == "rx_hostname " + prev_val[0] + "\n"); REQUIRE(oss.str() == "rx_hostname " + prev_val[0] + "\n");
} }
} else {
REQUIRE_THROWS(caller.call("rx_hostname", {"localhost"}, -1, PUT));
}
} }
TEST_CASE("Caller::rx_tcpport", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_tcpport", "[.cmdcall][.rx]") {
@ -263,6 +309,8 @@ TEST_CASE("Caller::rx_tcpport", "[.cmdcall][.rx]") {
TEST_CASE("Caller::rx_fifodepth", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_fifodepth", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxFifoDepth(); auto prev_val = det.getRxFifoDepth();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -282,11 +330,16 @@ TEST_CASE("Caller::rx_fifodepth", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setRxFifoDepth(prev_val[i], {i}); det.setRxFifoDepth(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_fifodepth", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_silent", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_silent", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxSilentMode(); auto prev_val = det.getRxSilentMode();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -306,11 +359,16 @@ TEST_CASE("Caller::rx_silent", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setRxSilentMode(prev_val[i], {i}); det.setRxSilentMode(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_silent", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_discardpolicy", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_discardpolicy", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxFrameDiscardPolicy(); auto prev_val = det.getRxFrameDiscardPolicy();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -335,11 +393,16 @@ TEST_CASE("Caller::rx_discardpolicy", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setRxFrameDiscardPolicy(prev_val[i], {i}); det.setRxFrameDiscardPolicy(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_discardpolicy", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_padding", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_padding", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPartialFramesPadding(); auto prev_val = det.getPartialFramesPadding();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -359,11 +422,16 @@ TEST_CASE("Caller::rx_padding", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setPartialFramesPadding(prev_val[i], {i}); det.setPartialFramesPadding(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_padding", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_udpsocksize", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_udpsocksize", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
int64_t prev_val = det.getRxUDPSocketBufferSize().tsquash( int64_t prev_val = det.getRxUDPSocketBufferSize().tsquash(
"Need same udp socket buffer size to test"); "Need same udp socket buffer size to test");
std::string s_new_val = std::to_string(prev_val); std::string s_new_val = std::to_string(prev_val);
@ -379,11 +447,16 @@ TEST_CASE("Caller::rx_udpsocksize", "[.cmdcall][.rx]") {
REQUIRE(oss.str() >= "rx_udpsocksize " + s_new_val + "\n"); REQUIRE(oss.str() >= "rx_udpsocksize " + s_new_val + "\n");
} }
det.setRxUDPSocketBufferSize(prev_val); det.setRxUDPSocketBufferSize(prev_val);
} else {
REQUIRE_THROWS(caller.call("rx_udpsocksize", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_realudpsocksize", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_realudpsocksize", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
uint64_t val = 0; uint64_t val = 0;
{ {
std::ostringstream oss; std::ostringstream oss;
@ -398,11 +471,16 @@ TEST_CASE("Caller::rx_realudpsocksize", "[.cmdcall][.rx]") {
uint64_t rval = std::stol(s); uint64_t rval = std::stol(s);
REQUIRE(rval >= val * 2); REQUIRE(rval >= val * 2);
} }
} else {
REQUIRE_THROWS(caller.call("rx_realudpsocksize", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_lock", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_lock", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxLock(); auto prev_val = det.getRxLock();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -422,28 +500,43 @@ TEST_CASE("Caller::rx_lock", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setRxLock(prev_val[i], {i}); det.setRxLock(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_lock", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_lastclient", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_lastclient", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
std::ostringstream oss; std::ostringstream oss;
REQUIRE_NOTHROW(caller.call("rx_lastclient", {}, -1, GET, oss)); REQUIRE_NOTHROW(caller.call("rx_lastclient", {}, -1, GET, oss));
if (test::my_ip != "undefined") { if (test::my_ip != "undefined") {
REQUIRE(oss.str() == "rx_lastclient " + test::my_ip + "\n"); REQUIRE(oss.str() == "rx_lastclient " + test::my_ip + "\n");
} }
} else {
REQUIRE_THROWS(caller.call("rx_lastclient", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_threads", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_threads", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
std::ostringstream oss; std::ostringstream oss;
REQUIRE_NOTHROW(caller.call("rx_threads", {}, -1, GET, oss)); REQUIRE_NOTHROW(caller.call("rx_threads", {}, -1, GET, oss));
} else {
REQUIRE_THROWS(caller.call("rx_threads", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_arping", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_arping", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxArping(); auto prev_val = det.getRxArping();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -463,14 +556,17 @@ TEST_CASE("Caller::rx_arping", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setRxArping(prev_val[i], {i}); det.setRxArping(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_arping", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_roi", "[.cmdcall]") { TEST_CASE("Caller::rx_roi", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type != defs::XILINX_CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) { if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_THROWS(caller.call("rx_roi", {"5", "10"}, -1, PUT)); REQUIRE_THROWS(caller.call("rx_roi", {"5", "10"}, -1, PUT));
} else { } else {
auto prev_val = det.getRxROI(); auto prev_val = det.getRxROI();
@ -502,7 +598,8 @@ TEST_CASE("Caller::rx_roi", "[.cmdcall]") {
} }
{ {
std::ostringstream oss; std::ostringstream oss;
caller.call("rx_roi", {"10", "22", "18", "19"}, -1, PUT, oss); caller.call("rx_roi", {"10", "22", "18", "19"}, -1, PUT,
oss);
REQUIRE(oss.str() == "rx_roi [10, 22, 18, 19]\n"); REQUIRE(oss.str() == "rx_roi [10, 22, 18, 19]\n");
} }
{ {
@ -525,14 +622,17 @@ TEST_CASE("Caller::rx_roi", "[.cmdcall]") {
det.setRxROI(prev_val); det.setRxROI(prev_val);
} }
} }
} else {
REQUIRE_THROWS(caller.call("rx_roi", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_clearroi", "[.cmdcall]") { TEST_CASE("Caller::rx_clearroi", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type != defs::XILINX_CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) { if (det_type == defs::CHIPTESTBOARD) {
REQUIRE_THROWS(caller.call("rx_clearroi", {}, -1, PUT)); REQUIRE_THROWS(caller.call("rx_clearroi", {}, -1, PUT));
} else { } else {
auto prev_val = det.getRxROI(); auto prev_val = det.getRxROI();
@ -545,6 +645,9 @@ TEST_CASE("Caller::rx_clearroi", "[.cmdcall]") {
det.setRxROI(prev_val); det.setRxROI(prev_val);
} }
} }
} else {
REQUIRE_THROWS(caller.call("rx_clearroi", {}, -1, PUT));
}
} }
/* File */ /* File */
@ -552,6 +655,8 @@ TEST_CASE("Caller::rx_clearroi", "[.cmdcall]") {
TEST_CASE("Caller::fformat", "[.cmdcall]") { TEST_CASE("Caller::fformat", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getFileFormat(); auto prev_val = det.getFileFormat();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -566,11 +671,16 @@ TEST_CASE("Caller::fformat", "[.cmdcall]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setFileFormat(prev_val[i], {i}); det.setFileFormat(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("fformat", {}, -1, GET));
}
} }
TEST_CASE("Caller::fpath", "[.cmdcall]") { TEST_CASE("Caller::fpath", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getFilePath(); auto prev_val = det.getFilePath();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -585,11 +695,16 @@ TEST_CASE("Caller::fpath", "[.cmdcall]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setFilePath(prev_val[i], {i}); det.setFilePath(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("fpath", {}, -1, GET));
}
} }
TEST_CASE("Caller::fname", "[.cmdcall]") { TEST_CASE("Caller::fname", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getFileNamePrefix(); auto prev_val = det.getFileNamePrefix();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -612,11 +727,16 @@ TEST_CASE("Caller::fname", "[.cmdcall]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setFileNamePrefix(prev_val[i], {i}); det.setFileNamePrefix(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("fname", {}, -1, GET));
}
} }
TEST_CASE("Caller::findex", "[.cmdcall]") { TEST_CASE("Caller::findex", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getAcquisitionIndex(); auto prev_val = det.getAcquisitionIndex();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -636,11 +756,16 @@ TEST_CASE("Caller::findex", "[.cmdcall]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setAcquisitionIndex(prev_val[i], {i}); det.setAcquisitionIndex(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("findex", {}, -1, GET));
}
} }
TEST_CASE("Caller::fwrite", "[.cmdcall]") { TEST_CASE("Caller::fwrite", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getFileWrite(); auto prev_val = det.getFileWrite();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -660,11 +785,16 @@ TEST_CASE("Caller::fwrite", "[.cmdcall]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setFileWrite(prev_val[i], {i}); det.setFileWrite(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("fwrite", {}, -1, GET));
}
} }
TEST_CASE("Caller::fmaster", "[.cmdcall]") { TEST_CASE("Caller::fmaster", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getMasterFileWrite(); auto prev_val = det.getMasterFileWrite();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -682,11 +812,16 @@ TEST_CASE("Caller::fmaster", "[.cmdcall]") {
REQUIRE(oss.str() == "fmaster 1\n"); REQUIRE(oss.str() == "fmaster 1\n");
} }
det.setMasterFileWrite(prev_val); det.setMasterFileWrite(prev_val);
} else {
REQUIRE_THROWS(caller.call("fmaster", {}, -1, GET));
}
} }
TEST_CASE("Caller::foverwrite", "[.cmdcall]") { TEST_CASE("Caller::foverwrite", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getFileOverWrite(); auto prev_val = det.getFileOverWrite();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -706,11 +841,16 @@ TEST_CASE("Caller::foverwrite", "[.cmdcall]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setFileOverWrite(prev_val[i], {i}); det.setFileOverWrite(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("foverwrite", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_framesperfile", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_framesperfile", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getFramesPerFile(); auto prev_val = det.getFramesPerFile();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -735,6 +875,9 @@ TEST_CASE("Caller::rx_framesperfile", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setFramesPerFile(prev_val[i], {i}); det.setFramesPerFile(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_framesperfile", {}, -1, GET));
}
} }
/* ZMQ Streaming Parameters (Receiver<->Client) */ /* ZMQ Streaming Parameters (Receiver<->Client) */
@ -742,6 +885,8 @@ TEST_CASE("Caller::rx_framesperfile", "[.cmdcall][.rx]") {
TEST_CASE("Caller::rx_zmqstream", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_zmqstream", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxZmqDataStream(); auto prev_val = det.getRxZmqDataStream();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -763,11 +908,16 @@ TEST_CASE("Caller::rx_zmqstream", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setRxZmqDataStream(prev_val[i], {i}); det.setRxZmqDataStream(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_zmqstream", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_zmqfreq", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_zmqfreq", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxZmqFrequency(); auto prev_val = det.getRxZmqFrequency();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -787,11 +937,16 @@ TEST_CASE("Caller::rx_zmqfreq", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setRxZmqFrequency(prev_val[i], {i}); det.setRxZmqFrequency(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_zmqfreq", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_zmqstartfnum", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_zmqstartfnum", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxZmqStartingFrame(); auto prev_val = det.getRxZmqStartingFrame();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -811,11 +966,16 @@ TEST_CASE("Caller::rx_zmqstartfnum", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setRxZmqStartingFrame(prev_val[i], {i}); det.setRxZmqStartingFrame(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_zmqstartfnum", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_zmqport", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_zmqport", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val_zmqport = det.getRxZmqPort(); auto prev_val_zmqport = det.getRxZmqPort();
auto prev_val_numinterfaces = det.getNumberofUDPInterfaces().tsquash( auto prev_val_numinterfaces = det.getNumberofUDPInterfaces().tsquash(
"inconsistent number of udp interfaces to test"); "inconsistent number of udp interfaces to test");
@ -833,18 +993,18 @@ TEST_CASE("Caller::rx_zmqport", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
std::ostringstream oss; std::ostringstream oss;
caller.call("rx_zmqport", {}, i, GET, oss); caller.call("rx_zmqport", {}, i, GET, oss);
REQUIRE(oss.str() == "rx_zmqport " + REQUIRE(oss.str() ==
std::to_string(port + i * socketsperdetector) + "rx_zmqport " +
'\n'); std::to_string(port + i * socketsperdetector) + '\n');
} }
port = 30001; port = 30001;
caller.call("rx_zmqport", {std::to_string(port)}, -1, PUT); caller.call("rx_zmqport", {std::to_string(port)}, -1, PUT);
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
std::ostringstream oss; std::ostringstream oss;
caller.call("rx_zmqport", {}, i, GET, oss); caller.call("rx_zmqport", {}, i, GET, oss);
REQUIRE(oss.str() == "rx_zmqport " + REQUIRE(oss.str() ==
std::to_string(port + i * socketsperdetector) + "rx_zmqport " +
'\n'); std::to_string(port + i * socketsperdetector) + '\n');
} }
test_valid_port_caller("rx_zmqport", {}, -1, PUT); test_valid_port_caller("rx_zmqport", {}, -1, PUT);
test_valid_port_caller("rx_zmqport", {}, 0, PUT); test_valid_port_caller("rx_zmqport", {}, 0, PUT);
@ -859,11 +1019,16 @@ TEST_CASE("Caller::rx_zmqport", "[.cmdcall][.rx]") {
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) { if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH) {
det.setNumberofUDPInterfaces(prev_val_numinterfaces); det.setNumberofUDPInterfaces(prev_val_numinterfaces);
} }
} else {
REQUIRE_THROWS(caller.call("rx_zmqport", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_zmqip", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_zmqip", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxZmqIP(); auto prev_val = det.getRxZmqIP();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -879,13 +1044,18 @@ TEST_CASE("Caller::rx_zmqip", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setRxZmqIP(prev_val[i], {i}); det.setRxZmqIP(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_zmqip", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_zmqhwm", "[.cmdcall]") { TEST_CASE("Caller::rx_zmqhwm", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto prev_val = auto det_type = det.getDetectorType().squash();
det.getRxZmqHwm().tsquash("Inconsistent values for rx_zmqhwm to test"); if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxZmqHwm().tsquash(
"Inconsistent values for rx_zmqhwm to test");
{ {
std::ostringstream oss; std::ostringstream oss;
caller.call("rx_zmqhwm", {"50"}, -1, PUT, oss); caller.call("rx_zmqhwm", {"50"}, -1, PUT, oss);
@ -907,6 +1077,9 @@ TEST_CASE("Caller::rx_zmqhwm", "[.cmdcall]") {
REQUIRE(oss.str() == "rx_zmqhwm -1\n"); REQUIRE(oss.str() == "rx_zmqhwm -1\n");
} }
det.setRxZmqHwm(prev_val); det.setRxZmqHwm(prev_val);
} else {
REQUIRE_THROWS(caller.call("rx_zmqhwm", {}, -1, GET));
}
} }
/* CTB Specific */ /* CTB Specific */
@ -915,8 +1088,7 @@ TEST_CASE("Caller::rx_dbitlist", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxDbitList(); auto prev_val = det.getRxDbitList();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -945,8 +1117,7 @@ TEST_CASE("Caller::rx_dbitoffset", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getRxDbitOffset(); auto prev_val = det.getRxDbitOffset();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -979,18 +1150,22 @@ TEST_CASE("Caller::rx_dbitoffset", "[.cmdcall][.rx]") {
TEST_CASE("Caller::rx_jsonaddheader", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_jsonaddheader", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getAdditionalJsonHeader(); auto prev_val = det.getAdditionalJsonHeader();
{ {
std::ostringstream oss; std::ostringstream oss;
caller.call("rx_jsonaddheader", {"key1", "value1", "key2", "value2"}, caller.call("rx_jsonaddheader",
-1, PUT, oss); {"key1", "value1", "key2", "value2"}, -1, PUT, oss);
REQUIRE(oss.str() == "rx_jsonaddheader {key1: value1, key2: value2}\n"); REQUIRE(oss.str() ==
"rx_jsonaddheader {key1: value1, key2: value2}\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
caller.call("rx_jsonaddheader", {}, -1, GET, oss); caller.call("rx_jsonaddheader", {}, -1, GET, oss);
REQUIRE(oss.str() == "rx_jsonaddheader {key1: value1, key2: value2}\n"); REQUIRE(oss.str() ==
"rx_jsonaddheader {key1: value1, key2: value2}\n");
} }
{ {
std::ostringstream oss; std::ostringstream oss;
@ -1000,11 +1175,16 @@ TEST_CASE("Caller::rx_jsonaddheader", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setAdditionalJsonHeader(prev_val[i], {i}); det.setAdditionalJsonHeader(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_jsonaddheader", {}, -1, GET));
}
} }
TEST_CASE("Caller::rx_jsonpara", "[.cmdcall][.rx]") { TEST_CASE("Caller::rx_jsonpara", "[.cmdcall][.rx]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getAdditionalJsonHeader(); auto prev_val = det.getAdditionalJsonHeader();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -1030,6 +1210,9 @@ TEST_CASE("Caller::rx_jsonpara", "[.cmdcall][.rx]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setAdditionalJsonHeader(prev_val[i], {i}); det.setAdditionalJsonHeader(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("rx_jsonpara", {}, -1, GET));
}
} }
/* Insignificant */ /* Insignificant */

View File

@ -1,35 +0,0 @@
// SPDX-License-Identifier: LGPL-3.0-or-other
// Copyright (C) 2021 Contributors to the SLS Detector Package
#include "Caller.h"
#include "catch.hpp"
#include "sls/Detector.h"
#include "sls/sls_detector_defs.h"
#include <sstream>
#include "sls/Result.h"
#include "sls/ToString.h"
#include "sls/versionAPI.h"
#include "test-Caller-global.h"
#include "tests/globals.h"
namespace sls {
using test::GET;
using test::PUT;
/* dacs */
TEST_CASE("CALLER::configtransceiver", "[.cmdcall]") {
Detector det;
Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::XILINX_CHIPTESTBOARD) {
REQUIRE_THROWS(caller.call("configtransceiver", {}, -1, GET));
REQUIRE_NOTHROW(caller.call("configtransceiver", {}, -1, PUT));
} else {
REQUIRE_THROWS(caller.call("configtransceiver", {}, -1, PUT));
REQUIRE_THROWS(caller.call("configtransceiver", {}, -1, GET));
}
}
} // namespace sls

View File

@ -825,12 +825,13 @@ TEST_CASE("CALLER::exptime", "[.cmdcall][.time]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
std::chrono::nanoseconds prev_val; std::chrono::nanoseconds prev_val;
if (det_type != defs::MYTHEN3) { if (det_type != defs::MYTHEN3) {
prev_val = det.getExptime().tsquash("inconsistent exptime to test"); prev_val = det.getExptime().tsquash("inconsistent exptime to test");
} else { } else {
auto t = auto t = det.getExptimeForAllGates().tsquash(
det.getExptimeForAllGates().tsquash("inconsistent exptime to test"); "inconsistent exptime to test");
if (t[0] != t[1] || t[1] != t[2]) { if (t[0] != t[1] || t[1] != t[2]) {
throw RuntimeError("inconsistent exptime for all gates"); throw RuntimeError("inconsistent exptime for all gates");
} }
@ -869,11 +870,16 @@ TEST_CASE("CALLER::exptime", "[.cmdcall][.time]") {
} }
} }
det.setExptime(-1, prev_val); det.setExptime(-1, prev_val);
} else {
REQUIRE_THROWS(caller.call("exptime", {}, -1, GET));
}
} }
TEST_CASE("CALLER::period", "[.cmdcall]") { TEST_CASE("CALLER::period", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPeriod(); auto prev_val = det.getPeriod();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -893,12 +899,16 @@ TEST_CASE("CALLER::period", "[.cmdcall]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setPeriod(prev_val[i], {i}); det.setPeriod(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("period", {}, -1, GET));
}
} }
TEST_CASE("CALLER::delay", "[.cmdcall]") { TEST_CASE("CALLER::delay", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
if (det_type == defs::EIGER) { if (det_type == defs::EIGER) {
REQUIRE_THROWS(caller.call("delay", {"1"}, -1, PUT)); REQUIRE_THROWS(caller.call("delay", {"1"}, -1, PUT));
REQUIRE_THROWS(caller.call("delay", {}, -1, GET)); REQUIRE_THROWS(caller.call("delay", {}, -1, GET));
@ -926,6 +936,9 @@ TEST_CASE("CALLER::delay", "[.cmdcall]") {
det.setDelayAfterTrigger(prev_val[i], {i}); det.setDelayAfterTrigger(prev_val[i], {i});
} }
} }
} else {
REQUIRE_THROWS(caller.call("delay", {}, -1, GET));
}
} }
TEST_CASE("CALLER::framesl", "[.cmdcall]") { TEST_CASE("CALLER::framesl", "[.cmdcall]") {
@ -956,6 +969,10 @@ TEST_CASE("CALLER::delayl", "[.cmdcall]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
switch (det_type) { switch (det_type) {
case defs::EIGER: case defs::EIGER:
case defs::CHIPTESTBOARD:
case defs::XILINX_CHIPTESTBOARD:
case defs::GOTTHARD2:
case defs::MYTHEN3:
REQUIRE_THROWS(caller.call("delayl", {}, -1, GET)); REQUIRE_THROWS(caller.call("delayl", {}, -1, GET));
break; break;
default: default:
@ -970,6 +987,10 @@ TEST_CASE("CALLER::periodl", "[.cmdcall]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
switch (det_type) { switch (det_type) {
case defs::EIGER: case defs::EIGER:
case defs::CHIPTESTBOARD:
case defs::XILINX_CHIPTESTBOARD:
case defs::GOTTHARD2:
case defs::MYTHEN3:
REQUIRE_THROWS(caller.call("periodl", {}, -1, GET)); REQUIRE_THROWS(caller.call("periodl", {}, -1, GET));
break; break;
default: default:
@ -1493,8 +1514,7 @@ TEST_CASE("CALLER::powerchip", "[.cmdcall]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH || if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH ||
det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2 || det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getPowerChip(); auto prev_val = det.getPowerChip();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -1513,9 +1533,6 @@ TEST_CASE("CALLER::powerchip", "[.cmdcall]") {
} }
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setPowerChip(prev_val[i], {i}); det.setPowerChip(prev_val[i], {i});
if (det_type == defs::XILINX_CHIPTESTBOARD) {
det.configureTransceiver();
}
} }
} else { } else {
REQUIRE_THROWS(caller.call("powerchip", {}, -1, GET)); REQUIRE_THROWS(caller.call("powerchip", {}, -1, GET));
@ -1985,7 +2002,8 @@ TEST_CASE("CALLER::temp_fpga", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type != defs::CHIPTESTBOARD) { if (det_type != defs::CHIPTESTBOARD &&
det_type != defs::XILINX_CHIPTESTBOARD) {
REQUIRE_NOTHROW(caller.call("temp_fpga", {}, -1, GET)); REQUIRE_NOTHROW(caller.call("temp_fpga", {}, -1, GET));
std::ostringstream oss; std::ostringstream oss;
REQUIRE_NOTHROW(caller.call("temp_fpga", {}, 0, GET, oss)); REQUIRE_NOTHROW(caller.call("temp_fpga", {}, 0, GET, oss));
@ -2003,8 +2021,7 @@ TEST_CASE("CALLER::daclist", "[.cmdcall]") {
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || if (det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
REQUIRE_NOTHROW(caller.call("daclist", {}, -1, GET)); REQUIRE_NOTHROW(caller.call("daclist", {}, -1, GET));
auto prev = det.getDacNames(); auto prev = det.getDacNames();
@ -2037,8 +2054,13 @@ TEST_CASE("CALLER::daclist", "[.cmdcall]") {
TEST_CASE("CALLER::dacvalues", "[.cmdcall]") { TEST_CASE("CALLER::dacvalues", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
REQUIRE_NOTHROW(caller.call("dacvalues", {}, -1, GET)); REQUIRE_NOTHROW(caller.call("dacvalues", {}, -1, GET));
REQUIRE_THROWS(caller.call("dacvalues", {}, -1, PUT)); REQUIRE_THROWS(caller.call("dacvalues", {}, -1, PUT));
} else {
REQUIRE_THROWS(caller.call("dacvalues", {}, -1, GET));
}
} }
TEST_CASE("CALLER::defaultdac", "[.cmdcall]") { TEST_CASE("CALLER::defaultdac", "[.cmdcall]") {
@ -2224,6 +2246,8 @@ TEST_CASE("CALLER::clearbusy", "[.cmdcall]") {
TEST_CASE("CALLER::start", "[.cmdcall]") { TEST_CASE("CALLER::start", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
// PUT only command // PUT only command
REQUIRE_THROWS(caller.call("start", {}, -1, GET)); REQUIRE_THROWS(caller.call("start", {}, -1, GET));
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
@ -2231,8 +2255,8 @@ TEST_CASE("CALLER::start", "[.cmdcall]") {
if (det_type != defs::MYTHEN3) { if (det_type != defs::MYTHEN3) {
prev_val = det.getExptime().tsquash("inconsistent exptime to test"); prev_val = det.getExptime().tsquash("inconsistent exptime to test");
} else { } else {
auto t = auto t = det.getExptimeForAllGates().tsquash(
det.getExptimeForAllGates().tsquash("inconsistent exptime to test"); "inconsistent exptime to test");
if (t[0] != t[1] || t[1] != t[2]) { if (t[0] != t[1] || t[1] != t[2]) {
throw RuntimeError("inconsistent exptime for all gates"); throw RuntimeError("inconsistent exptime for all gates");
} }
@ -2240,7 +2264,8 @@ TEST_CASE("CALLER::start", "[.cmdcall]") {
} }
auto prev_frames = auto prev_frames =
det.getNumberOfFrames().tsquash("inconsistent #frames in test"); det.getNumberOfFrames().tsquash("inconsistent #frames in test");
auto prev_period = det.getPeriod().tsquash("inconsistent period in test"); auto prev_period =
det.getPeriod().tsquash("inconsistent period in test");
det.setExptime(-1, std::chrono::microseconds(200)); det.setExptime(-1, std::chrono::microseconds(200));
det.setPeriod(std::chrono::milliseconds(1)); det.setPeriod(std::chrono::milliseconds(1));
det.setNumberOfFrames(2000); det.setNumberOfFrames(2000);
@ -2258,11 +2283,16 @@ TEST_CASE("CALLER::start", "[.cmdcall]") {
det.setExptime(-1, prev_val); det.setExptime(-1, prev_val);
det.setPeriod(prev_period); det.setPeriod(prev_period);
det.setNumberOfFrames(prev_frames); det.setNumberOfFrames(prev_frames);
} else {
REQUIRE_THROWS(caller.call("start", {}, -1, GET));
}
} }
TEST_CASE("CALLER::stop", "[.cmdcall]") { TEST_CASE("CALLER::stop", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
// PUT only command // PUT only command
REQUIRE_THROWS(caller.call("stop", {}, -1, GET)); REQUIRE_THROWS(caller.call("stop", {}, -1, GET));
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
@ -2270,8 +2300,8 @@ TEST_CASE("CALLER::stop", "[.cmdcall]") {
if (det_type != defs::MYTHEN3) { if (det_type != defs::MYTHEN3) {
prev_val = det.getExptime().tsquash("inconsistent exptime to test"); prev_val = det.getExptime().tsquash("inconsistent exptime to test");
} else { } else {
auto t = auto t = det.getExptimeForAllGates().tsquash(
det.getExptimeForAllGates().tsquash("inconsistent exptime to test"); "inconsistent exptime to test");
if (t[0] != t[1] || t[1] != t[2]) { if (t[0] != t[1] || t[1] != t[2]) {
throw RuntimeError("inconsistent exptime for all gates"); throw RuntimeError("inconsistent exptime for all gates");
} }
@ -2279,7 +2309,8 @@ TEST_CASE("CALLER::stop", "[.cmdcall]") {
} }
auto prev_frames = auto prev_frames =
det.getNumberOfFrames().tsquash("inconsistent #frames in test"); det.getNumberOfFrames().tsquash("inconsistent #frames in test");
auto prev_period = det.getPeriod().tsquash("inconsistent period in test"); auto prev_period =
det.getPeriod().tsquash("inconsistent period in test");
det.setExptime(-1, std::chrono::microseconds(200)); det.setExptime(-1, std::chrono::microseconds(200));
det.setPeriod(std::chrono::milliseconds(1)); det.setPeriod(std::chrono::milliseconds(1));
det.setNumberOfFrames(2000); det.setNumberOfFrames(2000);
@ -2303,18 +2334,22 @@ TEST_CASE("CALLER::stop", "[.cmdcall]") {
det.setExptime(-1, prev_val); det.setExptime(-1, prev_val);
det.setPeriod(prev_period); det.setPeriod(prev_period);
det.setNumberOfFrames(prev_frames); det.setNumberOfFrames(prev_frames);
} else {
REQUIRE_THROWS(caller.call("stop", {}, -1, GET));
}
} }
TEST_CASE("CALLER::status", "[.cmdcall]") { TEST_CASE("CALLER::status", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
std::chrono::nanoseconds prev_val; std::chrono::nanoseconds prev_val;
if (det_type != defs::MYTHEN3) { if (det_type != defs::MYTHEN3) {
prev_val = det.getExptime().tsquash("inconsistent exptime to test"); prev_val = det.getExptime().tsquash("inconsistent exptime to test");
} else { } else {
auto t = auto t = det.getExptimeForAllGates().tsquash(
det.getExptimeForAllGates().tsquash("inconsistent exptime to test"); "inconsistent exptime to test");
if (t[0] != t[1] || t[1] != t[2]) { if (t[0] != t[1] || t[1] != t[2]) {
throw RuntimeError("inconsistent exptime for all gates"); throw RuntimeError("inconsistent exptime for all gates");
} }
@ -2322,7 +2357,8 @@ TEST_CASE("CALLER::status", "[.cmdcall]") {
} }
auto prev_frames = auto prev_frames =
det.getNumberOfFrames().tsquash("inconsistent #frames in test"); det.getNumberOfFrames().tsquash("inconsistent #frames in test");
auto prev_period = det.getPeriod().tsquash("inconsistent period in test"); auto prev_period =
det.getPeriod().tsquash("inconsistent period in test");
det.setExptime(-1, std::chrono::microseconds(200)); det.setExptime(-1, std::chrono::microseconds(200));
det.setPeriod(std::chrono::milliseconds(1)); det.setPeriod(std::chrono::milliseconds(1));
det.setNumberOfFrames(2000); det.setNumberOfFrames(2000);
@ -2342,6 +2378,9 @@ TEST_CASE("CALLER::status", "[.cmdcall]") {
det.setExptime(-1, prev_val); det.setExptime(-1, prev_val);
det.setPeriod(prev_period); det.setPeriod(prev_period);
det.setNumberOfFrames(prev_frames); det.setNumberOfFrames(prev_frames);
} else {
REQUIRE_THROWS(caller.call("status", {}, -1, GET));
}
} }
TEST_CASE("CALLER::nextframenumber", "[.cmdcall]") { TEST_CASE("CALLER::nextframenumber", "[.cmdcall]") {
@ -2349,8 +2388,7 @@ TEST_CASE("CALLER::nextframenumber", "[.cmdcall]") {
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU || if (det_type == defs::EIGER || det_type == defs::JUNGFRAU ||
det_type == defs::MOENCH || det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH || det_type == defs::CHIPTESTBOARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
auto prev_sfnum = det.getNextFrameNumber(); auto prev_sfnum = det.getNextFrameNumber();
REQUIRE_THROWS(caller.call("nextframenumber", {"0"}, -1, PUT)); REQUIRE_THROWS(caller.call("nextframenumber", {"0"}, -1, PUT));
{ {
@ -2417,9 +2455,9 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
defs::dacIndex ind = defs::DAC_0; defs::dacIndex ind = defs::DAC_0;
defs::dacIndex notImplementedInd = defs::DAC_0; defs::dacIndex notImplementedInd = defs::DAC_0;
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
switch (det_type) { switch (det_type) {
case defs::CHIPTESTBOARD: case defs::CHIPTESTBOARD:
case defs::XILINX_CHIPTESTBOARD:
ind = defs::DAC_0; ind = defs::DAC_0;
notImplementedInd = defs::VSVP; notImplementedInd = defs::VSVP;
break; break;
@ -2460,8 +2498,8 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
} else { } else {
{ {
std::ostringstream oss; std::ostringstream oss;
caller.call("scan", {ToString(ind), "500", "1500", "500"}, -1, PUT, caller.call("scan", {ToString(ind), "500", "1500", "500"}, -1,
oss); PUT, oss);
CHECK(oss.str() == CHECK(oss.str() ==
"scan [" + ToString(ind) + ", 500, 1500, 500]\n"); "scan [" + ToString(ind) + ", 500, 1500, 500]\n");
} }
@ -2474,8 +2512,8 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
} }
{ {
std::ostringstream oss; std::ostringstream oss;
caller.call("scan", {ToString(ind), "500", "1500", "500", "2s"}, -1, caller.call("scan", {ToString(ind), "500", "1500", "500", "2s"},
PUT, oss); -1, PUT, oss);
CHECK(oss.str() == CHECK(oss.str() ==
"scan [" + ToString(ind) + ", 500, 1500, 500, 2s]\n"); "scan [" + ToString(ind) + ", 500, 1500, 500, 2s]\n");
} }
@ -2498,18 +2536,18 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
} }
{ {
std::ostringstream oss; std::ostringstream oss;
caller.call("scan", {ToString(ind), "1500", "500", "-500"}, -1, PUT, caller.call("scan", {ToString(ind), "1500", "500", "-500"}, -1,
oss); PUT, oss);
CHECK(oss.str() == CHECK(oss.str() ==
"scan [" + ToString(ind) + ", 1500, 500, -500]\n"); "scan [" + ToString(ind) + ", 1500, 500, -500]\n");
} }
CHECK_THROWS(caller.call( CHECK_THROWS(caller.call(
"scan", {ToString(notImplementedInd), "500", "1500", "500"}, -1, "scan", {ToString(notImplementedInd), "500", "1500", "500"}, -1,
PUT)); PUT));
CHECK_THROWS(caller.call("scan", {ToString(ind), "500", "1500", "-500"}, CHECK_THROWS(caller.call(
-1, PUT)); "scan", {ToString(ind), "500", "1500", "-500"}, -1, PUT));
CHECK_THROWS(caller.call("scan", {ToString(ind), "1500", "500", "500"}, CHECK_THROWS(caller.call(
-1, PUT)); "scan", {ToString(ind), "1500", "500", "500"}, -1, PUT));
if (det_type == defs::MYTHEN3 || defs::EIGER) { if (det_type == defs::MYTHEN3 || defs::EIGER) {
{ {
@ -2539,6 +2577,10 @@ TEST_CASE("CALLER::scan", "[.cmdcall]") {
// false, {i}); // false, {i});
// } // }
} }
} else {
REQUIRE_THROWS(caller.call(
"scan", {ToString(defs::DAC_0), "500", "1500", "500"}, -1, PUT));
}
} }
TEST_CASE("CALLER::scanerrmsg", "[.cmdcall]") { TEST_CASE("CALLER::scanerrmsg", "[.cmdcall]") {
@ -2593,6 +2635,8 @@ TEST_CASE("CALLER::numinterfaces", "[.cmdcall]") {
TEST_CASE("CALLER::udp_srcip", "[.cmdcall]") { TEST_CASE("CALLER::udp_srcip", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getSourceUDPIP(); auto prev_val = det.getSourceUDPIP();
REQUIRE_THROWS(caller.call("udp_srcip", {"0.0.0.0"}, -1, PUT)); REQUIRE_THROWS(caller.call("udp_srcip", {"0.0.0.0"}, -1, PUT));
{ {
@ -2603,6 +2647,9 @@ TEST_CASE("CALLER::udp_srcip", "[.cmdcall]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setSourceUDPIP(prev_val[i], {i}); det.setSourceUDPIP(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("udp_srcip", {}, -1, GET));
}
} }
TEST_CASE("CALLER::udp_dstlist", "[.cmdcall]") { TEST_CASE("CALLER::udp_dstlist", "[.cmdcall]") {
@ -2637,9 +2684,14 @@ TEST_CASE("CALLER::udp_numdst", "[.cmdcall]") {
TEST_CASE("CALLER::udp_cleardst", "[.cmdcall]") { TEST_CASE("CALLER::udp_cleardst", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
REQUIRE_THROWS(caller.call("udp_cleardst", {}, -1, GET)); REQUIRE_THROWS(caller.call("udp_cleardst", {}, -1, GET));
/* dont clear all udp destinations */ /* dont clear all udp destinations */
/*REQUIRE_NOTHROW(caller.call("udp_cleardst", {}, -1, PUT));*/ /*REQUIRE_NOTHROW(caller.call("udp_cleardst", {}, -1, PUT));*/
} else {
REQUIRE_THROWS(caller.call("udp_cleardst", {}, -1, PUT));
}
} }
TEST_CASE("CALLER::udp_firstdst", "[.cmdcall]") { TEST_CASE("CALLER::udp_firstdst", "[.cmdcall]") {
@ -2685,8 +2737,11 @@ TEST_CASE("CALLER::udp_dstip", "[.cmdcall]") {
TEST_CASE("CALLER::udp_srcmac", "[.cmdcall]") { TEST_CASE("CALLER::udp_srcmac", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getSourceUDPMAC(); auto prev_val = det.getSourceUDPMAC();
REQUIRE_THROWS(caller.call("udp_srcmac", {"00:00:00:00:00:00"}, -1, PUT)); REQUIRE_THROWS(
caller.call("udp_srcmac", {"00:00:00:00:00:00"}, -1, PUT));
{ {
std::ostringstream oss; std::ostringstream oss;
caller.call("udp_srcmac", {"00:50:c2:42:34:12"}, -1, PUT, oss); caller.call("udp_srcmac", {"00:50:c2:42:34:12"}, -1, PUT, oss);
@ -2697,6 +2752,9 @@ TEST_CASE("CALLER::udp_srcmac", "[.cmdcall]") {
det.setSourceUDPMAC(prev_val[i], {i}); det.setSourceUDPMAC(prev_val[i], {i});
} }
} }
} else {
REQUIRE_THROWS(caller.call("udp_srcmac", {}, -1, GET));
}
} }
TEST_CASE("CALLER::udp_dstmac", "[.cmdcall]") { TEST_CASE("CALLER::udp_dstmac", "[.cmdcall]") {
@ -2708,6 +2766,8 @@ TEST_CASE("CALLER::udp_dstmac", "[.cmdcall]") {
TEST_CASE("CALLER::udp_dstport", "[.cmdcall]") { TEST_CASE("CALLER::udp_dstport", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
auto prev_val = det.getDestinationUDPPort(); auto prev_val = det.getDestinationUDPPort();
{ {
std::ostringstream oss; std::ostringstream oss;
@ -2724,6 +2784,9 @@ TEST_CASE("CALLER::udp_dstport", "[.cmdcall]") {
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setDestinationUDPPort(prev_val[i], {i}); det.setDestinationUDPPort(prev_val[i], {i});
} }
} else {
REQUIRE_THROWS(caller.call("udp_dstport", {}, -1, GET));
}
} }
TEST_CASE("CALLER::udp_srcip2", "[.cmdcall]") { TEST_CASE("CALLER::udp_srcip2", "[.cmdcall]") {
@ -2829,15 +2892,25 @@ TEST_CASE("CALLER::udp_dstport2", "[.cmdcall]") {
TEST_CASE("CALLER::udp_reconfigure", "[.cmdcall]") { TEST_CASE("CALLER::udp_reconfigure", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
REQUIRE_THROWS(caller.call("udp_reconfigure", {}, -1, GET)); REQUIRE_THROWS(caller.call("udp_reconfigure", {}, -1, GET));
REQUIRE_NOTHROW(caller.call("udp_reconfigure", {}, -1, PUT)); REQUIRE_NOTHROW(caller.call("udp_reconfigure", {}, -1, PUT));
} else {
REQUIRE_THROWS(caller.call("udp_reconfigure", {}, -1, PUT));
}
} }
TEST_CASE("CALLER::udp_validate", "[.cmdcall]") { TEST_CASE("CALLER::udp_validate", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
REQUIRE_THROWS(caller.call("udp_validate", {}, -1, GET)); REQUIRE_THROWS(caller.call("udp_validate", {}, -1, GET));
REQUIRE_NOTHROW(caller.call("udp_validate", {}, -1, PUT)); REQUIRE_NOTHROW(caller.call("udp_validate", {}, -1, PUT));
} else {
REQUIRE_THROWS(caller.call("udp_validate", {}, -1, PUT));
}
} }
TEST_CASE("CALLER::tengiga", "[.cmdcall]") { TEST_CASE("CALLER::tengiga", "[.cmdcall]") {
@ -3057,6 +3130,8 @@ TEST_CASE("CALLER::zmqport", "[.cmdcall]") {
TEST_CASE("CALLER::zmqip", "[.cmdcall]") { TEST_CASE("CALLER::zmqip", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
std::ostringstream oss1, oss2; std::ostringstream oss1, oss2;
auto zmqip = det.getClientZmqIp(); auto zmqip = det.getClientZmqIp();
caller.call("zmqip", {}, 0, GET, oss1); caller.call("zmqip", {}, 0, GET, oss1);
@ -3069,6 +3144,7 @@ TEST_CASE("CALLER::zmqip", "[.cmdcall]") {
det.setRxZmqIP(zmqip[i], {i}); det.setRxZmqIP(zmqip[i], {i});
} }
} }
}
TEST_CASE("CALLER::zmqhwm", "[.cmdcall]") { TEST_CASE("CALLER::zmqhwm", "[.cmdcall]") {
Detector det; Detector det;
@ -3155,7 +3231,7 @@ TEST_CASE("CALLER::resetfpga", "[.cmdcall]") {
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD || if (det_type == defs::JUNGFRAU || det_type == defs::CHIPTESTBOARD ||
det_type == defs::MOENCH || det_type == defs::XILINX_CHIPTESTBOARD) { det_type == defs::MOENCH) {
// reset will also reset udp info from config file (comment out for // reset will also reset udp info from config file (comment out for
// invdividual tests) std::ostringstream oss; caller.call("resetfpga", // invdividual tests) std::ostringstream oss; caller.call("resetfpga",
// {}, -1, PUT, oss); REQUIRE(oss.str() == "resetfpga successful\n"); // {}, -1, PUT, oss); REQUIRE(oss.str() == "resetfpga successful\n");
@ -3191,8 +3267,7 @@ TEST_CASE("CALLER::rebootcontroller", "[.cmdcall]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH || if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH ||
det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3 || det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3 ||
det_type == defs::GOTTHARD2 || det_type == defs::GOTTHARD || det_type == defs::GOTTHARD2 || det_type == defs::GOTTHARD) {
det_type == defs::XILINX_CHIPTESTBOARD) {
// TODO: reboot real server? // TODO: reboot real server?
// REQUIRE_NOTHROW(caller.call("rebootcontroller", {}, -1, PUT)); // REQUIRE_NOTHROW(caller.call("rebootcontroller", {}, -1, PUT));
REQUIRE_THROWS(caller.call("rebootcontroller", {}, -1, GET)); REQUIRE_THROWS(caller.call("rebootcontroller", {}, -1, GET));
@ -3224,6 +3299,7 @@ TEST_CASE("CALLER::reg", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type != defs::XILINX_CHIPTESTBOARD) {
if (det_type != defs::EIGER) { if (det_type != defs::EIGER) {
uint32_t addr = 0x64; uint32_t addr = 0x64;
std::string saddr = ToStringHex(addr); std::string saddr = ToStringHex(addr);
@ -3243,6 +3319,9 @@ TEST_CASE("CALLER::reg", "[.cmdcall]") {
else { else {
REQUIRE_NOTHROW(caller.call("reg", {"0x64"}, -1, GET)); REQUIRE_NOTHROW(caller.call("reg", {"0x64"}, -1, GET));
} }
} else {
REQUIRE_THROWS(caller.call("reg", {}, -1, GET));
}
} }
TEST_CASE("CALLER::adcreg", "[.cmdcall]") { TEST_CASE("CALLER::adcreg", "[.cmdcall]") {
@ -3267,7 +3346,7 @@ TEST_CASE("CALLER::setbit", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type != defs::EIGER) { if (det_type != defs::EIGER && det_type != defs::XILINX_CHIPTESTBOARD) {
uint32_t addr = 0x64; uint32_t addr = 0x64;
std::string saddr = ToStringHex(addr); std::string saddr = ToStringHex(addr);
auto prev_val = det.readRegister(addr); auto prev_val = det.readRegister(addr);
@ -3289,7 +3368,7 @@ TEST_CASE("CALLER::clearbit", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type != defs::EIGER) { if (det_type != defs::EIGER && det_type != defs::XILINX_CHIPTESTBOARD) {
uint32_t addr = 0x64; uint32_t addr = 0x64;
std::string saddr = ToStringHex(addr); std::string saddr = ToStringHex(addr);
auto prev_val = det.readRegister(addr); auto prev_val = det.readRegister(addr);
@ -3311,7 +3390,9 @@ TEST_CASE("CALLER::getbit", "[.cmdcall]") {
Detector det; Detector det;
Caller caller(&det); Caller caller(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type != defs::EIGER) { if (det_type == defs::XILINX_CHIPTESTBOARD) {
REQUIRE_THROWS(caller.call("getbit", {"0x64", "1"}, -1, GET));
} else if (det_type != defs::EIGER) {
uint32_t addr = 0x64; uint32_t addr = 0x64;
std::string saddr = ToStringHex(addr); std::string saddr = ToStringHex(addr);
auto prev_val = det.readRegister(addr); auto prev_val = det.readRegister(addr);
@ -3337,8 +3418,7 @@ TEST_CASE("CALLER::firmwaretest", "[.cmdcall]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH || if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH ||
det_type == defs::CHIPTESTBOARD || det_type == defs::GOTTHARD || det_type == defs::CHIPTESTBOARD || det_type == defs::GOTTHARD ||
det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2 || det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD2) {
det_type == defs::XILINX_CHIPTESTBOARD) {
std::ostringstream oss; std::ostringstream oss;
caller.call("firmwaretest", {}, -1, PUT, oss); caller.call("firmwaretest", {}, -1, PUT, oss);
REQUIRE(oss.str() == "firmwaretest successful\n"); REQUIRE(oss.str() == "firmwaretest successful\n");
@ -3500,7 +3580,7 @@ TEST_CASE("CALLER::framecounter", "[.cmdcall]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH || if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH ||
det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3 || det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3 ||
det_type == defs::GOTTHARD2 || det_type == defs::XILINX_CHIPTESTBOARD) { det_type == defs::GOTTHARD2) {
auto framecounter = det.getNumberOfFramesFromStart().squash(); auto framecounter = det.getNumberOfFramesFromStart().squash();
std::ostringstream oss; std::ostringstream oss;
caller.call("framecounter", {}, -1, GET, oss); caller.call("framecounter", {}, -1, GET, oss);
@ -3519,7 +3599,7 @@ TEST_CASE("CALLER::runtime", "[.cmdcall]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH || if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH ||
det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3 || det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3 ||
det_type == defs::GOTTHARD2 || det_type == defs::XILINX_CHIPTESTBOARD) { det_type == defs::GOTTHARD2) {
std::ostringstream oss; std::ostringstream oss;
caller.call("runtime", {}, -1, GET, oss); caller.call("runtime", {}, -1, GET, oss);
// Get only // Get only
@ -3537,7 +3617,7 @@ TEST_CASE("CALLER::frametime", "[.cmdcall]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH || if (det_type == defs::JUNGFRAU || det_type == defs::MOENCH ||
det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3 || det_type == defs::CHIPTESTBOARD || det_type == defs::MYTHEN3 ||
det_type == defs::GOTTHARD2 || det_type == defs::XILINX_CHIPTESTBOARD) { det_type == defs::GOTTHARD2) {
std::ostringstream oss; std::ostringstream oss;
caller.call("frametime", {}, -1, GET, oss); caller.call("frametime", {}, -1, GET, oss);
// Get only // Get only

View File

@ -372,7 +372,7 @@ int ClientInterface::setup_receiver(Interface &socket) {
arg.additionalStorageCells); arg.additionalStorageCells);
} }
if (detType == CHIPTESTBOARD || detType == XILINX_CHIPTESTBOARD) { if (detType == CHIPTESTBOARD) {
impl()->setNumberofAnalogSamples(arg.analogSamples); impl()->setNumberofAnalogSamples(arg.analogSamples);
impl()->setNumberofDigitalSamples(arg.digitalSamples); impl()->setNumberofDigitalSamples(arg.digitalSamples);
impl()->setNumberofTransceiverSamples(arg.transceiverSamples); impl()->setNumberofTransceiverSamples(arg.transceiverSamples);
@ -409,14 +409,12 @@ int ClientInterface::setup_receiver(Interface &socket) {
detType == MYTHEN3) { detType == MYTHEN3) {
impl()->setTenGigaEnable(arg.tenGiga); impl()->setTenGigaEnable(arg.tenGiga);
} }
if (detType == CHIPTESTBOARD || detType == XILINX_CHIPTESTBOARD) { if (detType == CHIPTESTBOARD) {
impl()->setReadoutMode(arg.roMode); impl()->setReadoutMode(arg.roMode);
impl()->setADCEnableMask(arg.adcMask);
impl()->setTenGigaADCEnableMask(arg.adc10gMask); impl()->setTenGigaADCEnableMask(arg.adc10gMask);
impl()->setTransceiverEnableMask(arg.transceiverMask); impl()->setTransceiverEnableMask(arg.transceiverMask);
} }
if (detType == CHIPTESTBOARD) {
impl()->setADCEnableMask(arg.adcMask);
}
if (detType == GOTTHARD) { if (detType == GOTTHARD) {
impl()->setDetectorROI(arg.roi); impl()->setDetectorROI(arg.roi);
} }
@ -450,7 +448,6 @@ void ClientInterface::setDetectorType(detectorType arg) {
case GOTTHARD: case GOTTHARD:
case EIGER: case EIGER:
case CHIPTESTBOARD: case CHIPTESTBOARD:
case XILINX_CHIPTESTBOARD:
case JUNGFRAU: case JUNGFRAU:
case MOENCH: case MOENCH:
case MYTHEN3: case MYTHEN3:
@ -571,7 +568,7 @@ int ClientInterface::set_burst_mode(Interface &socket) {
int ClientInterface::set_num_analog_samples(Interface &socket) { int ClientInterface::set_num_analog_samples(Interface &socket) {
auto value = socket.Receive<int>(); auto value = socket.Receive<int>();
LOG(logDEBUG1) << "Setting num analog samples to " << value; LOG(logDEBUG1) << "Setting num analog samples to " << value;
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) { if (detType != CHIPTESTBOARD) {
functionNotImplemented(); functionNotImplemented();
} }
try { try {
@ -587,7 +584,7 @@ int ClientInterface::set_num_analog_samples(Interface &socket) {
int ClientInterface::set_num_digital_samples(Interface &socket) { int ClientInterface::set_num_digital_samples(Interface &socket) {
auto value = socket.Receive<int>(); auto value = socket.Receive<int>();
LOG(logDEBUG1) << "Setting num digital samples to " << value; LOG(logDEBUG1) << "Setting num digital samples to " << value;
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) { if (detType != CHIPTESTBOARD) {
functionNotImplemented(); functionNotImplemented();
} }
try { try {
@ -1252,7 +1249,7 @@ int ClientInterface::get_padding_enable(Interface &socket) {
int ClientInterface::set_readout_mode(Interface &socket) { int ClientInterface::set_readout_mode(Interface &socket) {
auto arg = socket.Receive<readoutMode>(); auto arg = socket.Receive<readoutMode>();
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) if (detType != CHIPTESTBOARD)
functionNotImplemented(); functionNotImplemented();
if (arg >= 0) { if (arg >= 0) {
@ -1297,7 +1294,7 @@ int ClientInterface::set_adc_mask(Interface &socket) {
int ClientInterface::set_dbit_list(Interface &socket) { int ClientInterface::set_dbit_list(Interface &socket) {
StaticVector<int, MAX_RX_DBIT> args; StaticVector<int, MAX_RX_DBIT> args;
socket.Receive(args); socket.Receive(args);
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) if (detType != CHIPTESTBOARD)
functionNotImplemented(); functionNotImplemented();
LOG(logDEBUG1) << "Setting DBIT list"; LOG(logDEBUG1) << "Setting DBIT list";
for (auto &it : args) { for (auto &it : args) {
@ -1310,7 +1307,7 @@ int ClientInterface::set_dbit_list(Interface &socket) {
} }
int ClientInterface::get_dbit_list(Interface &socket) { int ClientInterface::get_dbit_list(Interface &socket) {
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) if (detType != CHIPTESTBOARD)
functionNotImplemented(); functionNotImplemented();
StaticVector<int, MAX_RX_DBIT> retval; StaticVector<int, MAX_RX_DBIT> retval;
retval = impl()->getDbitList(); retval = impl()->getDbitList();
@ -1320,7 +1317,7 @@ int ClientInterface::get_dbit_list(Interface &socket) {
int ClientInterface::set_dbit_offset(Interface &socket) { int ClientInterface::set_dbit_offset(Interface &socket) {
auto arg = socket.Receive<int>(); auto arg = socket.Receive<int>();
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) if (detType != CHIPTESTBOARD)
functionNotImplemented(); functionNotImplemented();
if (arg < 0) { if (arg < 0) {
throw RuntimeError("Invalid dbit offset: " + std::to_string(arg)); throw RuntimeError("Invalid dbit offset: " + std::to_string(arg));
@ -1332,7 +1329,7 @@ int ClientInterface::set_dbit_offset(Interface &socket) {
} }
int ClientInterface::get_dbit_offset(Interface &socket) { int ClientInterface::get_dbit_offset(Interface &socket) {
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) if (detType != CHIPTESTBOARD)
functionNotImplemented(); functionNotImplemented();
int retval = impl()->getDbitOffset(); int retval = impl()->getDbitOffset();
LOG(logDEBUG1) << "Dbit offset retval: " << retval; LOG(logDEBUG1) << "Dbit offset retval: " << retval;
@ -1738,7 +1735,7 @@ int ClientInterface::get_receiver_roi(Interface &socket) {
int ClientInterface::set_receiver_roi(Interface &socket) { int ClientInterface::set_receiver_roi(Interface &socket) {
auto arg = socket.Receive<ROI>(); auto arg = socket.Receive<ROI>();
if (detType == CHIPTESTBOARD || detType == XILINX_CHIPTESTBOARD) if (detType == CHIPTESTBOARD)
functionNotImplemented(); functionNotImplemented();
LOG(logDEBUG1) << "Set Receiver ROI: " << ToString(arg); LOG(logDEBUG1) << "Set Receiver ROI: " << ToString(arg);
verifyIdle(socket); verifyIdle(socket);
@ -1754,7 +1751,7 @@ int ClientInterface::set_receiver_roi(Interface &socket) {
int ClientInterface::set_receiver_roi_metadata(Interface &socket) { int ClientInterface::set_receiver_roi_metadata(Interface &socket) {
auto arg = socket.Receive<ROI>(); auto arg = socket.Receive<ROI>();
if (detType == CHIPTESTBOARD || detType == XILINX_CHIPTESTBOARD) if (detType == CHIPTESTBOARD)
functionNotImplemented(); functionNotImplemented();
LOG(logDEBUG1) << "Set Receiver ROI Metadata: " << ToString(arg); LOG(logDEBUG1) << "Set Receiver ROI Metadata: " << ToString(arg);
verifyIdle(socket); verifyIdle(socket);
@ -1771,7 +1768,7 @@ int ClientInterface::set_receiver_roi_metadata(Interface &socket) {
int ClientInterface::set_num_transceiver_samples(Interface &socket) { int ClientInterface::set_num_transceiver_samples(Interface &socket) {
auto value = socket.Receive<int>(); auto value = socket.Receive<int>();
LOG(logDEBUG1) << "Setting num transceiver samples to " << value; LOG(logDEBUG1) << "Setting num transceiver samples to " << value;
if (detType != CHIPTESTBOARD && detType != XILINX_CHIPTESTBOARD) { if (detType != CHIPTESTBOARD) {
functionNotImplemented(); functionNotImplemented();
} }
try { try {

View File

@ -480,7 +480,6 @@ void DataProcessor::PadMissingPackets(sls_receiver_header header, char *data) {
memset(data + (pnum * dsize), 0xFF, dsize + 2); memset(data + (pnum * dsize), 0xFF, dsize + 2);
break; break;
case CHIPTESTBOARD: case CHIPTESTBOARD:
case XILINX_CHIPTESTBOARD:
if (pnum == (pperFrame - 1)) if (pnum == (pperFrame - 1))
memset(data + (pnum * dsize), 0xFF, corrected_dsize); memset(data + (pnum * dsize), 0xFF, corrected_dsize);
else else

View File

@ -648,122 +648,4 @@ class ChipTestBoardData : public GeneralData {
}; };
}; };
class XilinxChipTestBoardData : public GeneralData {
private:
const int NCHAN_DIGITAL = 64;
const int NUM_BYTES_PER_ANALOG_CHANNEL = 2;
const int NUM_BYTES_PER_TRANSCEIVER_CHANNEL = 8;
int nAnalogBytes = 0;
int nDigitalBytes = 0;
int nTransceiverBytes = 0;
public:
/** Constructor */
XilinxChipTestBoardData() {
detType = slsDetectorDefs::XILINX_CHIPTESTBOARD;
nPixelsY = 1; // number of samples
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
frameIndexMask = 0xFFFFFF; // 10g
frameIndexOffset = 8; // 10g
packetIndexMask = 0xFF; // 10g
framesPerFile = XILINX_CTB_MAX_FRAMES_PER_FILE;
fifoDepth = 2500;
standardheader = true;
dataSize = 8144;
packetSize = headerSizeinPacket + dataSize;
tengigaEnable = true;
UpdateImageSize();
};
public:
int GetNumberOfAnalogDatabytes() { return nAnalogBytes; };
int GetNumberOfDigitalDatabytes() { return nDigitalBytes; };
int GetNumberOfTransceiverDatabytes() { return nTransceiverBytes; };
void SetNumberOfAnalogSamples(int n) {
nAnalogSamples = n;
UpdateImageSize();
};
void SetNumberOfDigitalSamples(int n) {
nDigitalSamples = n;
UpdateImageSize();
};
void SetNumberOfTransceiverSamples(int n) {
nTransceiverSamples = n;
UpdateImageSize();
};
void SetOneGigaAdcEnableMask(int n) {
adcEnableMaskOneGiga = n;
UpdateImageSize();
};
void SetTenGigaAdcEnableMask(int n) {
adcEnableMaskTenGiga = n;
UpdateImageSize();
};
void SetTransceiverEnableMask(int n) {
transceiverMask = n;
UpdateImageSize();
};
void SetReadoutMode(slsDetectorDefs::readoutMode r) {
readoutType = r;
UpdateImageSize();
};
private:
void UpdateImageSize() {
nAnalogBytes = 0;
nDigitalBytes = 0;
nTransceiverBytes = 0;
int nAnalogChans = 0, nDigitalChans = 0, nTransceiverChans = 0;
// analog channels (normal, analog/digital readout)
if (readoutType == slsDetectorDefs::ANALOG_ONLY ||
readoutType == slsDetectorDefs::ANALOG_AND_DIGITAL) {
uint32_t adcEnableMask = adcEnableMaskTenGiga;
nAnalogChans = __builtin_popcount(adcEnableMask);
nAnalogBytes =
nAnalogChans * NUM_BYTES_PER_ANALOG_CHANNEL * nAnalogSamples;
LOG(logDEBUG1) << " Number of Analog Channels:" << nAnalogChans
<< " Databytes: " << nAnalogBytes;
}
// digital channels
if (readoutType == slsDetectorDefs::DIGITAL_ONLY ||
readoutType == slsDetectorDefs::ANALOG_AND_DIGITAL ||
readoutType == slsDetectorDefs::DIGITAL_AND_TRANSCEIVER) {
nDigitalChans = NCHAN_DIGITAL;
nDigitalBytes = (sizeof(uint64_t) * nDigitalSamples);
LOG(logDEBUG1) << "Number of Digital Channels:" << nDigitalChans
<< " Databytes: " << nDigitalBytes;
}
// transceiver channels
if (readoutType == slsDetectorDefs::TRANSCEIVER_ONLY ||
readoutType == slsDetectorDefs::DIGITAL_AND_TRANSCEIVER) {
nTransceiverChans = __builtin_popcount(transceiverMask);
;
nTransceiverBytes = nTransceiverChans *
NUM_BYTES_PER_TRANSCEIVER_CHANNEL *
nTransceiverSamples;
LOG(logDEBUG1) << "Number of Transceiver Channels:"
<< nTransceiverChans
<< " Databytes: " << nTransceiverBytes;
}
nPixelsX = nAnalogChans + nDigitalChans + nTransceiverChans;
imageSize = nAnalogBytes + nDigitalBytes + nTransceiverBytes;
packetsPerFrame = ceil((double)imageSize / (double)dataSize);
LOG(logDEBUG1) << "Total Number of Channels:" << nPixelsX
<< " Databytes: " << imageSize;
};
};
} // namespace sls } // namespace sls

View File

@ -116,7 +116,6 @@ void Implementation::setDetectorType(const detectorType d) {
case JUNGFRAU: case JUNGFRAU:
case MOENCH: case MOENCH:
case CHIPTESTBOARD: case CHIPTESTBOARD:
case XILINX_CHIPTESTBOARD:
case MYTHEN3: case MYTHEN3:
case GOTTHARD2: case GOTTHARD2:
LOG(logINFO) << " ***** " << ToString(d) << " Receiver *****"; LOG(logINFO) << " ***** " << ToString(d) << " Receiver *****";
@ -146,9 +145,6 @@ void Implementation::setDetectorType(const detectorType d) {
case CHIPTESTBOARD: case CHIPTESTBOARD:
generalData = new ChipTestBoardData(); generalData = new ChipTestBoardData();
break; break;
case XILINX_CHIPTESTBOARD:
generalData = new XilinxChipTestBoardData();
break;
case MYTHEN3: case MYTHEN3:
generalData = new Mythen3Data(); generalData = new Mythen3Data();
break; break;

View File

@ -471,7 +471,6 @@ void Listener::CopyPacket(char *dst, char *src, uint32_t dataSize,
memcpy(dst + dataSize - 2, &src[detHeaderSize], dataSize + 2); memcpy(dst + dataSize - 2, &src[detHeaderSize], dataSize + 2);
break; break;
case CHIPTESTBOARD: case CHIPTESTBOARD:
case XILINX_CHIPTESTBOARD:
if (pnum == (generalData->packetsPerFrame - 1)) if (pnum == (generalData->packetsPerFrame - 1))
memcpy(dst + (pnum * dataSize), &src[detHeaderSize], memcpy(dst + (pnum * dataSize), &src[detHeaderSize],
correctedDataSize); correctedDataSize);

View File

@ -31,9 +31,6 @@ void MasterAttributes::GetBinaryAttributes(
case slsDetectorDefs::CHIPTESTBOARD: case slsDetectorDefs::CHIPTESTBOARD:
GetCtbBinaryAttributes(w); GetCtbBinaryAttributes(w);
break; break;
case slsDetectorDefs::XILINX_CHIPTESTBOARD:
GetXilinxCtbBinaryAttributes(w);
break;
default: default:
throw RuntimeError("Unknown Detector type to get master attributes"); throw RuntimeError("Unknown Detector type to get master attributes");
} }
@ -66,9 +63,6 @@ void MasterAttributes::WriteHDF5Attributes(H5::H5File *fd, H5::Group *group) {
case slsDetectorDefs::CHIPTESTBOARD: case slsDetectorDefs::CHIPTESTBOARD:
WriteCtbHDF5Attributes(fd, group); WriteCtbHDF5Attributes(fd, group);
break; break;
case slsDetectorDefs::XILINX_CHIPTESTBOARD:
WriteXilinxCtbHDF5Attributes(fd, group);
break;
default: default:
throw RuntimeError("Unknown Detector type to get master attributes"); throw RuntimeError("Unknown Detector type to get master attributes");
} }
@ -820,49 +814,4 @@ void MasterAttributes::WriteCtbHDF5Attributes(H5::H5File *fd,
} }
#endif #endif
void MasterAttributes::GetXilinxCtbBinaryAttributes(
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w) {
w->Key("Exptime");
w->String(ToString(exptime).c_str());
w->Key("Period");
w->String(ToString(period).c_str());
w->Key("ADC Mask");
w->String(ToStringHex(adcmask).c_str());
w->Key("Analog Flag");
w->Uint(analog);
w->Key("Analog Samples");
w->Uint(analogSamples);
w->Key("Digital Flag");
w->Uint(digital);
w->Key("Digital Samples");
w->Uint(digitalSamples);
w->Key("Dbit Offset");
w->Uint(dbitoffset);
w->Key("Dbit Bitset");
w->Uint64(dbitlist);
w->Key("Transceiver Mask");
w->String(ToStringHex(transceiverMask).c_str());
w->Key("Transceiver Flag");
w->Uint(transceiver);
w->Key("Transceiver Samples");
w->Uint(transceiverSamples);
}
#ifdef HDF5C
void MasterAttributes::WriteXilinxCtbHDF5Attributes(H5::H5File *fd,
H5::Group *group) {
MasterAttributes::WriteHDF5Exptime(fd, group);
MasterAttributes::WriteHDF5Period(fd, group);
MasterAttributes::WriteHDF5AdcMask(fd, group);
MasterAttributes::WriteHDF5AnalogFlag(fd, group);
MasterAttributes::WriteHDF5AnalogSamples(fd, group);
MasterAttributes::WriteHDF5DigitalFlag(fd, group);
MasterAttributes::WriteHDF5DigitalSamples(fd, group);
MasterAttributes::WriteHDF5DbitOffset(fd, group);
MasterAttributes::WriteHDF5DbitList(fd, group);
MasterAttributes::WriteHDF5TransceiverMask(fd, group);
MasterAttributes::WriteHDF5TransceiverFlag(fd, group);
MasterAttributes::WriteHDF5TransceiverSamples(fd, group);
}
#endif
} // namespace sls } // namespace sls

View File

@ -152,12 +152,6 @@ class MasterAttributes {
#ifdef HDF5C #ifdef HDF5C
void WriteCtbHDF5Attributes(H5::H5File *fd, H5::Group *group); void WriteCtbHDF5Attributes(H5::H5File *fd, H5::Group *group);
#endif #endif
void GetXilinxCtbBinaryAttributes(
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
#ifdef HDF5C
void WriteXilinxCtbHDF5Attributes(H5::H5File *fd, H5::Group *group);
#endif
}; };
} // namespace sls } // namespace sls

View File

@ -28,7 +28,6 @@ namespace sls {
#define JFRAU_MAX_FRAMES_PER_FILE 10000 #define JFRAU_MAX_FRAMES_PER_FILE 10000
#define MOENCH_MAX_FRAMES_PER_FILE 100000 #define MOENCH_MAX_FRAMES_PER_FILE 100000
#define CTB_MAX_FRAMES_PER_FILE 20000 #define CTB_MAX_FRAMES_PER_FILE 20000
#define XILINX_CTB_MAX_FRAMES_PER_FILE 20000
#define MYTHEN3_MAX_FRAMES_PER_FILE 10000 #define MYTHEN3_MAX_FRAMES_PER_FILE 10000
#define GOTTHARD2_MAX_FRAMES_PER_FILE 20000 #define GOTTHARD2_MAX_FRAMES_PER_FILE 20000

View File

@ -292,7 +292,6 @@ enum detFuncs {
F_SET_COLUMN, F_SET_COLUMN,
F_GET_PEDESTAL_MODE, F_GET_PEDESTAL_MODE,
F_SET_PEDESTAL_MODE, F_SET_PEDESTAL_MODE,
F_CONFIG_TRANSCEIVER,
NUM_DET_FUNCTIONS, NUM_DET_FUNCTIONS,
RECEIVER_ENUM_START = 512, /**< detector function should not exceed this RECEIVER_ENUM_START = 512, /**< detector function should not exceed this
@ -692,7 +691,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_COLUMN: return "F_SET_COLUMN"; case F_SET_COLUMN: return "F_SET_COLUMN";
case F_GET_PEDESTAL_MODE: return "F_GET_PEDESTAL_MODE"; case F_GET_PEDESTAL_MODE: return "F_GET_PEDESTAL_MODE";
case F_SET_PEDESTAL_MODE: return "F_SET_PEDESTAL_MODE"; case F_SET_PEDESTAL_MODE: return "F_SET_PEDESTAL_MODE";
case F_CONFIG_TRANSCEIVER: return "F_CONFIG_TRANSCEIVER";
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS"; case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START"; case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";

View File

@ -20,7 +20,6 @@ Still this is better than strcpy and a buffer overflow...
*/ */
template <size_t array_size> template <size_t array_size>
void strcpy_safe(char (&destination)[array_size], const char *source) { void strcpy_safe(char (&destination)[array_size], const char *source) {
assert(source != nullptr);
assert(array_size > strlen(source)); assert(array_size > strlen(source));
strncpy(destination, source, array_size - 1); strncpy(destination, source, array_size - 1);
destination[array_size - 1] = '\0'; destination[array_size - 1] = '\0';

View File

@ -4,11 +4,11 @@
#define RELEASE "developer" #define RELEASE "developer"
#define APILIB "developer 0x230224" #define APILIB "developer 0x230224"
#define APIRECEIVER "developer 0x230224" #define APIRECEIVER "developer 0x230224"
#define APICTB "developer 0x240207" #define APICTB "developer 0x240110"
#define APIGOTTHARD "developer 0x240207" #define APIGOTTHARD "developer 0x240110"
#define APIGOTTHARD2 "developer 0x240207" #define APIGOTTHARD2 "developer 0x240110"
#define APIJUNGFRAU "developer 0x240207" #define APIJUNGFRAU "developer 0x240110"
#define APIMYTHEN3 "developer 0x240207" #define APIMYTHEN3 "developer 0x240110"
#define APIMOENCH "developer 0x240207" #define APIMOENCH "developer 0x240110"
#define APIXILINXCTB "developer 0x240207" #define APIEIGER "developer 0x240110"
#define APIEIGER "developer 0x240207" #define APIXILINXCTB "developer 0x240111"

View File

@ -99,7 +99,9 @@ def loadConfig(name, rx_hostname, settingsdir):
Log(Fore.GREEN, 'Loading config') Log(Fore.GREEN, 'Loading config')
try: try:
d = Detector() d = Detector()
if name == 'eiger': if name == 'xilinx_ctb':
d.hostname = 'localhost'
elif name == 'eiger':
d.hostname = 'localhost:' + str(DEFAULT_TCP_CNTRL_PORTNO) + '+localhost:' + str(HALFMOD2_TCP_CNTRL_PORTNO) d.hostname = 'localhost:' + str(DEFAULT_TCP_CNTRL_PORTNO) + '+localhost:' + str(HALFMOD2_TCP_CNTRL_PORTNO)
#d.udp_dstport = {2: 50003} #d.udp_dstport = {2: 50003}
# will set up for every module # will set up for every module
@ -118,10 +120,8 @@ def loadConfig(name, rx_hostname, settingsdir):
d.udp_srcip = d.udp_dstip d.udp_srcip = d.udp_dstip
else: else:
d.udp_srcip = 'auto' d.udp_srcip = 'auto'
if d.type == detectorType.JUNGFRAU or d.type == detectorType.MOENCH or d.type == detectorType.XILINX_CHIPTESTBOARD: if d.type == detectorType.JUNGFRAU or d.type == detectorType.MOENCH:
d.powerchip = 1 d.powerchip = 1
if d.type == detectorType.XILINX_CHIPTESTBOARD:
d.configureTransceiver()
except: except:
Log(Fore.RED, 'Could not load config for ' + name) Log(Fore.RED, 'Could not load config for ' + name)
raise raise
@ -221,7 +221,7 @@ with open(fname, 'w') as fp:
startCmdTests(server, fp, file_results) startCmdTests(server, fp, file_results)
cleanup(server) cleanup(server)
except: except:
Log(Fore.RED, 'Exception caught. Cleaning up.') Log(log.RED, 'Exception caught. Cleaning up.')
cleanup(server) cleanup(server)
sys.stdout = original_stdout sys.stdout = original_stdout
sys.stderr = original_stderr sys.stderr = original_stderr