readnlines->partialread, better debugging for TCP socket interface bug

This commit is contained in:
maliakal_d 2021-08-13 12:34:50 +02:00
parent eb652557b6
commit 62d697e91f
35 changed files with 131 additions and 119 deletions

View File

@ -73,6 +73,7 @@ vetoalg
vetostream
serialnumber (put)
dbitpipeline
readnlines->partialread
3. Firmware Requirements
========================

View File

@ -488,7 +488,7 @@ TEST_CASE("Eiger or Jungfrau nextframenumber",
CHECK(m.getNextFrameNumber() == (val + 1));
}
TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
TEST_CASE("Eiger partialread", "[.eigerintegration][partialread]") {
SingleDetectorConfig c;
// pick up multi detector from shm id 0
@ -501,16 +501,16 @@ TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
m.setDynamicRange(16);
m.enableTenGigabitEthernet(0);
m.setReadNLines(256);
CHECK(m.getReadNLines() == 256);
m.setReadNLines(1);
CHECK(m.getReadNLines() == 1);
m.setPartialReadout(256);
CHECK(m.getPartialReadout() == 256);
m.setPartialReadout(1);
CHECK(m.getPartialReadout() == 1);
m.setDynamicRange(8);
m.setReadNLines(256);
CHECK(m.getReadNLines() == 256);
CHECK_THROWS_AS(m.setReadNLines(1), sls::RuntimeError);
CHECK(m.getReadNLines() == 256);
CHECK_THROWS_AS(m.setReadNLines(0), sls::RuntimeError);
m.setReadNLines(256);
m.setPartialReadout(256);
CHECK(m.getPartialReadout() == 256);
CHECK_THROWS_AS(m.setPartialReadout(1), sls::RuntimeError);
CHECK(m.getPartialReadout() == 256);
CHECK_THROWS_AS(m.setPartialReadout(0), sls::RuntimeError);
m.setPartialReadout(256);
}

View File

@ -1846,9 +1846,9 @@ class Detector(CppDetectorApi):
@property
@element
def readnlines(self):
def partialread(self):
"""
[Eiger] Number of lines to read out per half module
[Eiger] Number of rows to read out per half module
Note
----
Options: 0 - 256. 256 is default. \n
@ -1856,8 +1856,8 @@ class Detector(CppDetectorApi):
"""
return self.getPartialReadout()
@readnlines.setter
def readnlines(self, value):
@partialread.setter
def partialread(self, value):
ut.set_using_dict(self.setPartialReadout, value)

View File

@ -38,7 +38,7 @@ int Beb_top = 0;
uint64_t Beb_deactivatedNextFrameNumber = 0;
int Beb_quadEnable = 0;
int Beb_positions[2] = {0, 0};
int Beb_readNLines = MAX_ROWS_PER_READOUT;
int Beb_partialReadout = MAX_ROWS_PER_READOUT;
int Beb_deactivated_transmission_flowcontrol_10g = 0;
int Beb_deactivated_transmission_delay_frame = 0;
int Beb_deactivated_transmission_delay_left = 0;
@ -1214,7 +1214,7 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
unsigned int maxnl = MAX_ROWS_PER_READOUT;
unsigned int maxnp = (ten_gig ? 4 : 16) * Beb_bit_mode;
unsigned int nl = Beb_readNLines;
unsigned int nl = Beb_partialReadout;
unsigned int npackets = (nl * maxnp) / maxnl;
if ((nl * maxnp) % maxnl) {
LOG(logERROR, ("Read N Lines is incorrect. Switching to Full Image "
@ -1612,7 +1612,7 @@ int Beb_GetNextFrameNumber(uint64_t *retval, int tengigaEnable) {
return OK;
}
void Beb_SetReadNLines(int value) { Beb_readNLines = value; }
void Beb_SetPartialReadout(int value) { Beb_partialReadout = value; }
uint16_t Beb_swap_uint16(uint16_t val) { return (val << 8) | (val >> 8); }

View File

@ -108,7 +108,7 @@ int Beb_SetDetectorPosition(int pos[]);
int Beb_SetNextFrameNumber(uint64_t value);
int Beb_GetNextFrameNumber(uint64_t *retval, int tengigaEnable);
void Beb_SetReadNLines(int value);
void Beb_SetPartialReadout(int value);
uint16_t Beb_swap_uint16(uint16_t val);
int Beb_open(u_int32_t **csp0base, u_int32_t offset);

View File

@ -1554,24 +1554,24 @@ int Feb_Control_SetChipSignalsToTrimQuad(int enable) {
return 1;
}
int Feb_Control_SetReadNLines(int value) {
LOG(logINFO, ("Setting Read N Lines to %d\n", value));
int Feb_Control_SetPartialReadout(int value) {
LOG(logINFO, ("Setting Partial Readout to %d\n", value));
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
DAQ_REG_PARTIAL_READOUT, value, 0, 0)) {
LOG(logERROR, ("Could not write %d to read n lines reg\n", value));
LOG(logERROR, ("Could not write %d to Partial Readout reg\n", value));
return 0;
}
return 1;
}
int Feb_Control_GetReadNLines() {
int Feb_Control_GetPartialReadout() {
uint32_t regVal = 0;
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
DAQ_REG_PARTIAL_READOUT, &regVal)) {
LOG(logERROR, ("Could not read back read n lines reg\n"));
LOG(logERROR, ("Could not read back Partial Readout reg\n"));
return -1;
}
LOG(logDEBUG1, ("Retval read n lines: %d\n", regVal));
LOG(logDEBUG1, ("Retval Partial Readout: %d\n", regVal));
return regVal;
}

View File

@ -88,8 +88,8 @@ void Feb_Control_SetMasterVariable(int val);
int Feb_Control_SetMaster(enum MASTERINDEX ind);
int Feb_Control_SetQuad(int val);
int Feb_Control_SetChipSignalsToTrimQuad(int enable);
int Feb_Control_SetReadNLines(int value);
int Feb_Control_GetReadNLines();
int Feb_Control_SetPartialReadout(int value);
int Feb_Control_GetPartialReadout();
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);

View File

@ -88,7 +88,7 @@ uint64_t eiger_virtual_nextframenumber = 1;
int eiger_virtual_detPos[2] = {0, 0};
int eiger_virtual_test_mode = 0;
int eiger_virtual_quad_mode = 0;
int eiger_virtual_read_nlines = 256;
int eiger_virtual_partial_readout = 256;
int eiger_virtual_interrupt_subframe = 0;
int eiger_virtual_left_datastream = 1;
int eiger_virtual_right_datastream = 1;
@ -708,7 +708,7 @@ void setupDetector() {
setIODelay(DEFAULT_IO_DELAY);
setTiming(DEFAULT_TIMING_MODE);
setNextFrameNumber(DEFAULT_STARTING_FRAME_NUMBER);
setReadNLines(MAX_ROWS_PER_READOUT);
setPartialReadout(MAX_ROWS_PER_READOUT);
// SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15);
eiger_tau_ns = DEFAULT_RATE_CORRECTION;
setRateCorrection(DEFAULT_RATE_CORRECTION);
@ -1671,29 +1671,29 @@ int getInterruptSubframe() {
#endif
}
int setReadNLines(int value) {
int setPartialReadout(int value) {
if (value < 0)
return FAIL;
#ifndef VIRTUAL
sharedMemory_lockLocalLink();
if (!Feb_Control_SetReadNLines(value)) {
if (!Feb_Control_SetPartialReadout(value)) {
sharedMemory_unlockLocalLink();
return FAIL;
}
sharedMemory_unlockLocalLink();
Beb_SetReadNLines(value);
Beb_SetPartialReadout(value);
#else
eiger_virtual_read_nlines = value;
eiger_virtual_partial_readout = value;
#endif
return OK;
}
int getReadNLines() {
int getPartialReadout() {
#ifdef VIRTUAL
return eiger_virtual_read_nlines;
return eiger_virtual_partial_readout;
#else
sharedMemory_lockLocalLink();
int retval = Feb_Control_GetReadNLines();
int retval = Feb_Control_GetPartialReadout();
sharedMemory_unlockLocalLink();
return retval;
#endif

View File

@ -409,8 +409,8 @@ int setQuad(int value);
int getQuad();
int setInterruptSubframe(int value);
int getInterruptSubframe();
int setReadNLines(int value);
int getReadNLines();
int setPartialReadout(int value);
int getPartialReadout();
#endif
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(EIGERD) || \
defined(MYTHEN3D)

View File

@ -144,8 +144,8 @@ int set_quad(int);
int get_quad(int);
int set_interrupt_subframe(int);
int get_interrupt_subframe(int);
int set_read_n_lines(int);
int get_read_n_lines(int);
int set_partial_readout(int);
int get_partial_readout(int);
void calculate_and_set_position();
int set_detector_position(int);
int check_detector_idle();

View File

@ -273,8 +273,8 @@ void function_table() {
flist[F_GET_QUAD] = &get_quad;
flist[F_SET_INTERRUPT_SUBFRAME] = &set_interrupt_subframe;
flist[F_GET_INTERRUPT_SUBFRAME] = &get_interrupt_subframe;
flist[F_SET_READ_N_LINES] = &set_read_n_lines;
flist[F_GET_READ_N_LINES] = &get_read_n_lines;
flist[F_SET_PARTIAL_READOUT] = &set_partial_readout;
flist[F_GET_PARTIAL_READOUT] = &get_partial_readout;
flist[F_SET_POSITION] = &set_detector_position;
flist[F_SET_SOURCE_UDP_MAC] = &set_source_udp_mac;
flist[F_GET_SOURCE_UDP_MAC] = &get_source_udp_mac;
@ -4717,14 +4717,14 @@ int get_interrupt_subframe(int file_des) {
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int set_read_n_lines(int file_des) {
int set_partial_readout(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int arg = 0;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
LOG(logINFO, ("Setting read n lines: %u\n", arg));
LOG(logDEBUG1, ("Setting partial readout: %u\n", arg));
#ifndef EIGERD
functionNotImplemented();
@ -4734,7 +4734,7 @@ int set_read_n_lines(int file_des) {
if (arg <= 0 || arg > MAX_ROWS_PER_READOUT) {
ret = FAIL;
sprintf(mess,
"Could not set number of lines readout. Must be between 1 "
"Could not set partial readout. Must be between 1 "
"and %d\n",
MAX_ROWS_PER_READOUT);
LOG(logERROR, (mess));
@ -4746,24 +4746,24 @@ int set_read_n_lines(int file_des) {
if ((arg * maxnp) % maxnl) {
ret = FAIL;
sprintf(mess,
"Could not set %d number of lines readout. For %d bit "
"Could not set %d partial readout. For %d bit "
"mode and 10 giga %s, (%d (num "
"lines) x %d (max num packets for this mode)) must be "
"rows) x %d (max num packets for this mode)) must be "
"divisible by %d\n",
arg, dr, isTenGiga ? "enabled" : "disabled", arg, maxnp,
maxnl);
LOG(logERROR, (mess));
} else {
if (setReadNLines(arg) == FAIL) {
if (setPartialReadout(arg) == FAIL) {
ret = FAIL;
sprintf(mess, "Could not set read n lines to %d.\n", arg);
sprintf(mess, "Could not set partial readout to %d.\n", arg);
LOG(logERROR, (mess));
} else {
int retval = getReadNLines();
int retval = getPartialReadout();
if (arg != retval) {
ret = FAIL;
sprintf(mess,
"Could not set read n lines. Set %d, but "
"Could not set partial readout. Set %d, but "
"read %d\n",
retval, arg);
LOG(logERROR, (mess));
@ -4776,24 +4776,24 @@ int set_read_n_lines(int file_des) {
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_read_n_lines(int file_des) {
int get_partial_readout(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
LOG(logDEBUG1, ("Getting read n lines\n"));
LOG(logDEBUG1, ("Getting partial readout\n"));
#ifndef EIGERD
functionNotImplemented();
#else
// get only
retval = getReadNLines();
retval = getPartialReadout();
if (retval == -1) {
ret = FAIL;
sprintf(mess, "Could not get read n lines. \n");
sprintf(mess, "Could not get partial readout. \n");
LOG(logERROR, (mess));
} else {
LOG(logDEBUG1, ("Read N Lines retval: %u\n", retval));
LOG(logDEBUG1, ("Partial readout retval: %u\n", retval));
}
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
@ -7126,9 +7126,9 @@ int get_receiver_parameters(int file_des) {
if (n < 0)
return printSocketReadError();
// readnlines
// partialReadout
#ifdef EIGERD
i32 = getReadNLines();
i32 = getPartialReadout();
#else
i32 = 0;
#endif

View File

@ -716,6 +716,7 @@ class CmdProxy {
{"rx_datastream", "rx_zmqstream"},
/* Eiger Specific */
{"readnlines", "partialread"},
{"resmat", "partialreset"},
/* Jungfrau Specific */
@ -914,7 +915,7 @@ class CmdProxy {
{"subdeadtime", &CmdProxy::subdeadtime},
{"overflow", &CmdProxy::overflow},
{"ratecorr", &CmdProxy::RateCorrection},
{"readnlines", &CmdProxy::readnlines},
{"partialread", &CmdProxy::partialread},
{"interruptsubframe", &CmdProxy::interruptsubframe},
{"measuredperiod", &CmdProxy::measuredperiod},
{"measuredsubperiod", &CmdProxy::measuredsubperiod},
@ -1809,7 +1810,7 @@ class CmdProxy {
"32 bit mode. Default is disabled.");
INTEGER_COMMAND_VEC_ID(
readnlines, getPartialReadout, setPartialReadout, StringTo<int>,
partialread, getPartialReadout, setPartialReadout, StringTo<int>,
"[1 - 256]\n\t[Eiger] Number of rows to readout per half module "
"starting from the centre. Options: 0 - 256. 256 is default. The "
"permissible values depend on dynamic range and 10Gbe enabled.");

View File

@ -1373,11 +1373,11 @@ void Detector::updateRxRateCorrections() {
}
Result<int> Detector::getPartialReadout(Positions pos) const {
return pimpl->Parallel(&Module::getReadNLines, pos);
return pimpl->Parallel(&Module::getPartialReadout, pos);
}
void Detector::setPartialReadout(const int lines, Positions pos) {
pimpl->Parallel(&Module::setReadNLines, pos, lines);
pimpl->Parallel(&Module::setPartialReadout, pos, lines);
}
Result<bool> Detector::getInterruptSubframe(Positions pos) const {

View File

@ -1469,14 +1469,14 @@ void Module::sendReceiverRateCorrections(const std::vector<int64_t> &t) {
}
}
int Module::getReadNLines() const {
return sendToDetector<int>(F_GET_READ_N_LINES);
int Module::getPartialReadout() const {
return sendToDetector<int>(F_GET_PARTIAL_READOUT);
}
void Module::setReadNLines(const int value) {
sendToDetector(F_SET_READ_N_LINES, value, nullptr);
void Module::setPartialReadout(const int value) {
sendToDetector(F_SET_PARTIAL_READOUT, value, nullptr);
if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_READ_N_LINES, value, nullptr);
sendToReceiver(F_SET_RECEIVER_PARTIAL_READOUT, value, nullptr);
}
}

View File

@ -337,8 +337,8 @@ class Module : public virtual slsDetectorDefs {
void setDefaultRateCorrection();
void setRateCorrection(int64_t t = 0);
void sendReceiverRateCorrections(const std::vector<int64_t> &t);
int getReadNLines() const;
void setReadNLines(const int value);
int getPartialReadout() const;
void setPartialReadout(const int value);
bool getInterruptSubframe() const;
void setInterruptSubframe(const bool enable);
int64_t getMeasuredPeriod() const;

View File

@ -374,7 +374,7 @@ TEST_CASE("ratecorr", "[.cmd]") {
}
}
TEST_CASE("readnlines", "[.cmd]") {
TEST_CASE("partialread", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
@ -382,25 +382,25 @@ TEST_CASE("readnlines", "[.cmd]") {
auto prev_val = det.getPartialReadout();
{
std::ostringstream oss;
proxy.Call("readnlines", {"256"}, -1, PUT, oss);
REQUIRE(oss.str() == "readnlines 256\n");
proxy.Call("partialread", {"256"}, -1, PUT, oss);
REQUIRE(oss.str() == "partialread 256\n");
}
{
std::ostringstream oss;
proxy.Call("readnlines", {}, -1, GET, oss);
REQUIRE(oss.str() == "readnlines 256\n");
proxy.Call("partialread", {}, -1, GET, oss);
REQUIRE(oss.str() == "partialread 256\n");
}
{
std::ostringstream oss;
proxy.Call("readnlines", {"16"}, -1, PUT, oss);
REQUIRE(oss.str() == "readnlines 16\n");
proxy.Call("partialread", {"16"}, -1, PUT, oss);
REQUIRE(oss.str() == "partialread 16\n");
}
REQUIRE_THROWS(proxy.Call("readnlines", {"0"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("partialread", {"0"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setPartialReadout(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("readnlines", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("partialread", {}, -1, GET));
}
}

View File

@ -187,7 +187,7 @@ int ClientInterface::functionTable(){
flist[F_SET_RECEIVER_DBIT_OFFSET] = &ClientInterface::set_dbit_offset;
flist[F_GET_RECEIVER_DBIT_OFFSET] = &ClientInterface::get_dbit_offset;
flist[F_SET_RECEIVER_QUAD] = &ClientInterface::set_quad_type;
flist[F_SET_RECEIVER_READ_N_LINES] = &ClientInterface::set_read_n_lines;
flist[F_SET_RECEIVER_PARTIAL_READOUT] = &ClientInterface::set_partial_readout;
flist[F_SET_RECEIVER_UDP_IP] = &ClientInterface::set_udp_ip;
flist[F_SET_RECEIVER_UDP_IP2] = &ClientInterface::set_udp_ip2;
flist[F_SET_RECEIVER_UDP_PORT] = &ClientInterface::set_udp_port;
@ -224,6 +224,7 @@ int ClientInterface::functionTable(){
int ClientInterface::decodeFunction(Interface &socket) {
ret = FAIL;
socket.Receive(fnum);
socket.setFnum(fnum);
if (fnum <= NUM_DET_FUNCTIONS || fnum >= NUM_REC_FUNCTIONS) {
throw RuntimeError("Unrecognized Function enum " +
std::to_string(fnum) + "\n");
@ -413,7 +414,7 @@ int ClientInterface::setup_receiver(Interface &socket) {
std::to_string(arg.quad) +
" due to fifo strucutre memory allocation");
}
impl()->setReadNLines(arg.numLinesReadout);
impl()->setPartialReadout(arg.partialReadout);
impl()->setThresholdEnergy(arg.thresholdEnergyeV[0]);
}
if (myDetectorType == MYTHEN3) {
@ -1403,16 +1404,16 @@ int ClientInterface::set_quad_type(Interface &socket) {
return socket.Send(OK);
}
int ClientInterface::set_read_n_lines(Interface &socket) {
int ClientInterface::set_partial_readout(Interface &socket) {
auto arg = socket.Receive<int>();
if (arg >= 0) {
verifyIdle(socket);
LOG(logDEBUG1) << "Setting Read N Lines:" << arg;
impl()->setReadNLines(arg);
LOG(logDEBUG1) << "Setting Partial Readout:" << arg;
impl()->setPartialReadout(arg);
}
int retval = impl()->getReadNLines();
validate(arg, retval, "set read n lines", DEC);
LOG(logDEBUG1) << "read n lines retval:" << retval;
int retval = impl()->getPartialReadout();
validate(arg, retval, "set partial readout", DEC);
LOG(logDEBUG1) << "read partial readout:" << retval;
return socket.Send(OK);
}

View File

@ -138,7 +138,7 @@ class ClientInterface : private virtual slsDetectorDefs {
int set_dbit_offset(sls::ServerInterface &socket);
int get_dbit_offset(sls::ServerInterface &socket);
int set_quad_type(sls::ServerInterface &socket);
int set_read_n_lines(sls::ServerInterface &socket);
int set_partial_readout(sls::ServerInterface &socket);
sls::MacAddr setUdpIp(sls::IpAddr arg);
int set_udp_ip(sls::ServerInterface &socket);
sls::MacAddr setUdpIp2(sls::IpAddr arg);

View File

@ -477,8 +477,8 @@ std::vector<uint64_t> Implementation::getNumMissingPackets() const {
int np = generalData->packetsPerFrame;
uint64_t totnp = np;
// partial readout
if (numLinesReadout != MAX_EIGER_ROWS_PER_READOUT) {
totnp = ((numLinesReadout * np) / MAX_EIGER_ROWS_PER_READOUT);
if (partialReadout != MAX_EIGER_ROWS_PER_READOUT) {
totnp = ((partialReadout * np) / MAX_EIGER_ROWS_PER_READOUT);
}
totnp *= numberOfTotalFrames;
mp[i] = listener[i]->GetNumMissingPacket(stoppedFlag, totnp);
@ -765,7 +765,7 @@ void Implementation::SetupWriter() {
masterAttributes->subExptime = subExpTime;
masterAttributes->subPeriod = subPeriod;
masterAttributes->quad = quadEnable;
masterAttributes->numLinesReadout = numLinesReadout;
masterAttributes->partialReadout = partialReadout;
masterAttributes->ratecorr = rateCorrections;
masterAttributes->adcmask =
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga;
@ -1533,11 +1533,11 @@ void Implementation::setDeactivatedPadding(bool enable) {
<< (deactivatedPaddingEnable ? "enabled" : "disabled");
}
int Implementation::getReadNLines() const { return numLinesReadout; }
int Implementation::getPartialReadout() const { return partialReadout; }
void Implementation::setReadNLines(const int value) {
numLinesReadout = value;
LOG(logINFO) << "Number of Lines to readout: " << numLinesReadout;
void Implementation::setPartialReadout(const int value) {
partialReadout = value;
LOG(logINFO) << "Partial readout (#rows): " << partialReadout;
}
void Implementation::setThresholdEnergy(const int value) {

View File

@ -218,9 +218,9 @@ class Implementation : private virtual slsDetectorDefs {
bool getDeactivatedPadding() const;
/* [Eiger] */
void setDeactivatedPadding(const bool enable);
int getReadNLines() const;
int getPartialReadout() const;
/* [Eiger] */
void setReadNLines(const int value);
void setPartialReadout(const int value);
/** [Eiger] */
void setThresholdEnergy(const int value);
void setThresholdEnergy(const std::array<int, 3> value);
@ -352,7 +352,7 @@ class Implementation : private virtual slsDetectorDefs {
bool activated{true};
std::array<bool, 2> detectorDataStream = {{true, true}};
bool deactivatedPaddingEnable{true};
int numLinesReadout{MAX_EIGER_ROWS_PER_READOUT};
int partialReadout{MAX_EIGER_ROWS_PER_READOUT};
int thresholdEnergyeV{-1};
std::array<int, 3> thresholdAllEnergyeV = {{-1, -1, -1}};
std::vector<int64_t> rateCorrections;

View File

@ -37,7 +37,7 @@ struct MasterAttributes {
ns subExptime{0};
ns subPeriod{0};
uint32_t quad{0};
uint32_t numLinesReadout;
uint32_t partialReadout;
std::vector<int64_t> ratecorr;
uint32_t adcmask{0};
uint32_t analog{0};
@ -373,7 +373,7 @@ class EigerMasterAttributes : public MasterAttributes {
<< "SubPeriod : " << sls::ToString(subPeriod)
<< '\n'
<< "Quad : " << quad << '\n'
<< "Number of Lines read out : " << numLinesReadout << '\n'
<< "Partial Readout (rows) : " << partialReadout << '\n'
<< "Rate Corrections : " << sls::ToString(ratecorr)
<< '\n';
std::string message = oss.str();
@ -427,12 +427,12 @@ class EigerMasterAttributes : public MasterAttributes {
group->createDataSet("Quad", PredType::NATIVE_INT, dataspace);
dataset.write(&quad, PredType::NATIVE_INT);
}
// numLinesReadout
// partialReadout
{
DataSpace dataspace = DataSpace(H5S_SCALAR);
DataSet dataset = group->createDataSet(
"Number of Lines read out", PredType::NATIVE_INT, dataspace);
dataset.write(&numLinesReadout, PredType::NATIVE_INT);
"Partial readout (rows)", PredType::NATIVE_INT, dataspace);
dataset.write(&partialReadout, PredType::NATIVE_INT);
}
// Rate corrections
{

View File

@ -25,6 +25,8 @@ class DataSocket {
DataSocket(const DataSocket &) = delete;
DataSocket &operator=(DataSocket const &) = delete;
int getSocketId() const { return sockfd_; }
int getFnum() const { return fnum_; }
int setFnum(const int fnum);
int Send(const void *buffer, size_t size);
@ -82,6 +84,7 @@ class DataSocket {
private:
int sockfd_ = -1;
int fnum_ {0};
};
}; // namespace sls

View File

@ -518,7 +518,7 @@ typedef struct {
int dataStreamLeft{0};
int dataStreamRight{0};
int quad{0};
int numLinesReadout{0};
int partialReadout{0};
int thresholdEnergyeV[3]{0, 0, 0};
int dynamicRange{16};
timingMode timMode{AUTO_TIMING};

View File

@ -124,8 +124,8 @@ enum detFuncs {
F_GET_QUAD,
F_SET_INTERRUPT_SUBFRAME,
F_GET_INTERRUPT_SUBFRAME,
F_SET_READ_N_LINES,
F_GET_READ_N_LINES,
F_SET_PARTIAL_READOUT,
F_GET_PARTIAL_READOUT,
F_SET_POSITION,
F_SET_SOURCE_UDP_MAC,
F_GET_SOURCE_UDP_MAC,
@ -326,7 +326,7 @@ enum detFuncs {
F_SET_RECEIVER_DBIT_OFFSET,
F_GET_RECEIVER_DBIT_OFFSET,
F_SET_RECEIVER_QUAD,
F_SET_RECEIVER_READ_N_LINES,
F_SET_RECEIVER_PARTIAL_READOUT,
F_SET_RECEIVER_UDP_IP,
F_SET_RECEIVER_UDP_IP2,
F_SET_RECEIVER_UDP_PORT,
@ -477,8 +477,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_GET_QUAD: return "F_GET_QUAD";
case F_SET_INTERRUPT_SUBFRAME: return "F_SET_INTERRUPT_SUBFRAME";
case F_GET_INTERRUPT_SUBFRAME: return "F_GET_INTERRUPT_SUBFRAME";
case F_SET_READ_N_LINES: return "F_SET_READ_N_LINES";
case F_GET_READ_N_LINES: return "F_GET_READ_N_LINES";
case F_SET_PARTIAL_READOUT: return "F_SET_PARTIAL_READOUT";
case F_GET_PARTIAL_READOUT: return "F_GET_PARTIAL_READOUT";
case F_SET_POSITION: return "F_SET_POSITION";
case F_SET_SOURCE_UDP_MAC: return "F_SET_SOURCE_UDP_MAC";
case F_GET_SOURCE_UDP_MAC: return "F_GET_SOURCE_UDP_MAC";
@ -677,7 +677,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
case F_SET_RECEIVER_DBIT_OFFSET: return "F_SET_RECEIVER_DBIT_OFFSET";
case F_GET_RECEIVER_DBIT_OFFSET: return "F_GET_RECEIVER_DBIT_OFFSET";
case F_SET_RECEIVER_QUAD: return "F_SET_RECEIVER_QUAD";
case F_SET_RECEIVER_READ_N_LINES: return "F_SET_RECEIVER_READ_N_LINES";
case F_SET_RECEIVER_PARTIAL_READOUT: return "F_SET_RECEIVER_PARTIAL_READOUT";
case F_SET_RECEIVER_UDP_IP: return "F_SET_RECEIVER_UDP_IP";
case F_SET_RECEIVER_UDP_IP2: return "F_SET_RECEIVER_UDP_IP2";
case F_SET_RECEIVER_UDP_PORT: return "F_SET_RECEIVER_UDP_PORT";

View File

@ -4,10 +4,10 @@
#define APIRECEIVER 0x210225
#define APIGUI 0x210225
#define APICTB 0x210812
#define APIGOTTHARD 0x210812
#define APIGOTTHARD2 0x210812
#define APIJUNGFRAU 0x210812
#define APIMYTHEN3 0x210812
#define APIMOENCH 0x210812
#define APIEIGER 0x210812
#define APICTB 0x210813
#define APIGOTTHARD 0x210813
#define APIGOTTHARD2 0x210813
#define APIJUNGFRAU 0x210813
#define APIMYTHEN3 0x210813
#define APIMOENCH 0x210813
#define APIEIGER 0x210813

View File

@ -63,6 +63,7 @@ int ClientSocket::sendCommandThenRead(int fnum, const void *args,
size_t retval_size) {
int ret = slsDetectorDefs::FAIL;
Send(&fnum, sizeof(fnum));
setFnum(fnum);
Send(args, args_size);
readReply(ret, retval, retval_size);
return ret;

View File

@ -1,5 +1,6 @@
#include "sls/DataSocket.h"
#include "sls/logger.h"
#include "sls/sls_detector_funcs.h"
#include "sls/sls_detector_exceptions.h"
#include <algorithm>
#include <arpa/inet.h>
@ -41,6 +42,10 @@ DataSocket &DataSocket::operator=(DataSocket &&move) noexcept {
return *this;
}
int DataSocket::setFnum(const int fnum) {
fnum_ = fnum;
}
int DataSocket::Receive(void *buffer, size_t size) {
// TODO!(Erik) Add sleep? how many reties?
int bytes_expected = static_cast<int>(size); // signed size
@ -58,7 +63,7 @@ int DataSocket::Receive(void *buffer, size_t size) {
} else {
std::ostringstream ss;
ss << "TCP socket read " << bytes_read << " bytes instead of "
<< bytes_expected << " bytes";
<< bytes_expected << " bytes (" << getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
throw sls::SocketError(ss.str());
}
}
@ -83,7 +88,7 @@ int DataSocket::Send(const void *buffer, size_t size) {
if (bytes_sent != data_size) {
std::ostringstream ss;
ss << "TCP socket sent " << bytes_sent << " bytes instead of "
<< data_size << " bytes";
<< data_size << " bytes (" << getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
throw sls::SocketError(ss.str());
}
return bytes_sent;

View File

@ -55,7 +55,7 @@ std::string ToString(const slsDetectorDefs::rxParameters &r) {
<< "leftDataStream:" << r.dataStreamLeft << std::endl
<< "rightDataStream:" << r.dataStreamRight << std::endl
<< "quad:" << r.quad << std::endl
<< "numLinesReadout:" << r.numLinesReadout << std::endl
<< "partialReadout:" << r.partialReadout << std::endl
<< "thresholdEnergyeV:" << ToString(r.thresholdEnergyeV) << std::endl
<< "dynamicRange:" << r.dynamicRange << std::endl
<< "timMode:" << r.timMode << std::endl