Merge pull request #294 from slsdetectorgroup/readnrows

Readnrows
This commit is contained in:
Dhanya Thattil 2021-09-09 10:42:34 +02:00 committed by GitHub
commit 00066e1e6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 167 additions and 178 deletions

View File

@ -1846,7 +1846,7 @@ class Detector(CppDetectorApi):
@property
@element
def partialread(self):
def readnrows(self):
"""
[Eiger] Number of rows to read out per half module starting from the centre.
[Jungfrau] Number of rows to read per module starting from the centre.
@ -1856,11 +1856,11 @@ class Detector(CppDetectorApi):
[Eiger]The permissible values depend on dynamic range and 10Gbe enabled.\n\n
[Jungfrau] Options: 8 - 512 (multiples of 8)
"""
return self.getPartialReadout()
return self.getReadNRows()
@partialread.setter
def partialread(self, value):
ut.set_using_dict(self.setPartialReadout, value)
@readnrows.setter
def readnrows(self, value):
ut.set_using_dict(self.setReadNRows, value)
@property

View File

@ -874,13 +874,13 @@ void init_det(py::module &m) {
(void (Detector::*)(sls::ns, sls::Positions)) &
Detector::setRateCorrection,
py::arg(), py::arg() = Positions{})
.def("getPartialReadout",
.def("getReadNRows",
(Result<int>(Detector::*)(sls::Positions) const) &
Detector::getPartialReadout,
Detector::getReadNRows,
py::arg() = Positions{})
.def("setPartialReadout",
.def("setReadNRows",
(void (Detector::*)(const int, sls::Positions)) &
Detector::setPartialReadout,
Detector::setReadNRows,
py::arg(), py::arg() = Positions{})
.def("getInterruptSubframe",
(Result<bool>(Detector::*)(sls::Positions) const) &

View File

@ -33,7 +33,7 @@ int Beb_top = 0;
uint64_t Beb_deactivatedNextFrameNumber = 0;
int Beb_quadEnable = 0;
int Beb_positions[2] = {0, 0};
int Beb_partialReadout = MAX_ROWS_PER_READOUT;
int Beb_readNRows = 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;
@ -903,7 +903,7 @@ int Beb_RequestNImages(int ten_gig, unsigned int nimages, int test_just_send_out
unsigned int maxnl = MAX_ROWS_PER_READOUT;
unsigned int maxnp = (ten_gig ? 4 : 16) * Beb_bit_mode;
unsigned int nl = Beb_partialReadout;
unsigned int nl = Beb_readNRows;
unsigned int npackets = (nl * maxnp) / maxnl;
if ((nl * maxnp) % maxnl) {
LOG(logERROR, ("Read N Lines is incorrect. Switching to Full Image "
@ -1265,7 +1265,7 @@ int Beb_GetNextFrameNumber(uint64_t *retval, int tengigaEnable) {
return OK;
}
void Beb_SetPartialReadout(int value) { Beb_partialReadout = value; }
void Beb_SetReadNRows(int value) { Beb_readNRows = value; }
int Beb_GetNumberofDestinations(int *retval) {
if (!Beb_activated) {

View File

@ -1554,24 +1554,24 @@ int Feb_Control_SetChipSignalsToTrimQuad(int enable) {
return 1;
}
int Feb_Control_SetPartialReadout(int value) {
LOG(logINFO, ("Setting Partial Readout to %d\n", value));
int Feb_Control_SetReadNRows(int value) {
LOG(logINFO, ("Setting number of rows 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 Partial Readout reg\n", value));
DAQ_REG_READ_N_ROWS, value, 0, 0)) {
LOG(logERROR, ("Could not write %d to number of rows reg\n", value));
return 0;
}
return 1;
}
int Feb_Control_GetPartialReadout() {
int Feb_Control_GetReadNRows() {
uint32_t regVal = 0;
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
DAQ_REG_PARTIAL_READOUT, &regVal)) {
LOG(logERROR, ("Could not read back Partial Readout reg\n"));
DAQ_REG_READ_N_ROWS, &regVal)) {
LOG(logERROR, ("Could not read back ReadNRows reg\n"));
return -1;
}
LOG(logDEBUG1, ("Retval Partial Readout: %d\n", regVal));
LOG(logDEBUG1, ("Retval ReadNRows: %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_SetPartialReadout(int value);
int Feb_Control_GetPartialReadout();
int Feb_Control_SetReadNRows(int value);
int Feb_Control_GetReadNRows();
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);

View File

@ -13,7 +13,7 @@
#define DAQ_REG_EXPOSURE_REPEAT_TIMER 5 // == (31 downto 3) * 10^(2 downto 0)
#define DAQ_REG_SUBFRAME_EXPOSURES 6
#define DAQ_REG_SUBFRAME_PERIOD 7 // also pg and fifo status register
#define DAQ_REG_PARTIAL_READOUT 8
#define DAQ_REG_READ_N_ROWS 8
#define DAQ_REG_HRDWRE 12
// clang-format off

View File

@ -85,7 +85,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_partial_readout = 256;
int eiger_virtual_read_n_rows = 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);
setPartialReadout(MAX_ROWS_PER_READOUT);
setReadNRows(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);
@ -1683,29 +1683,29 @@ int getInterruptSubframe() {
#endif
}
int setPartialReadout(int value) {
int setReadNRows(int value) {
if (value < 0)
return FAIL;
#ifndef VIRTUAL
sharedMemory_lockLocalLink();
if (!Feb_Control_SetPartialReadout(value)) {
if (!Feb_Control_SetReadNRows(value)) {
sharedMemory_unlockLocalLink();
return FAIL;
}
sharedMemory_unlockLocalLink();
Beb_SetPartialReadout(value);
Beb_SetReadNRows(value);
#else
eiger_virtual_partial_readout = value;
eiger_virtual_read_n_rows = value;
#endif
return OK;
}
int getPartialReadout() {
int getReadNRows() {
#ifdef VIRTUAL
return eiger_virtual_partial_readout;
return eiger_virtual_read_n_rows;
#else
sharedMemory_lockLocalLink();
int retval = Feb_Control_GetPartialReadout();
int retval = Feb_Control_GetReadNRows();
sharedMemory_unlockLocalLink();
return retval;
#endif
@ -2328,15 +2328,15 @@ void *start_timer(void *arg) {
int colLeft = top ? eiger_virtual_detPos[1] : eiger_virtual_detPos[1] + 1;
int colRight = top ? eiger_virtual_detPos[1] + 1 : eiger_virtual_detPos[1];
int partialReadout = getPartialReadout();
if (partialReadout == -1) {
int readNRows = getReadNRows();
if (readNRows == -1) {
LOG(logERROR,
("partial readout is -1. Assuming no partial readout.\n"));
partialReadout = MAX_ROWS_PER_READOUT;
("readNRows is -1. Assuming no readNRows.\n"));
readNRows = MAX_ROWS_PER_READOUT;
}
const int maxRows = MAX_ROWS_PER_READOUT;
const int packetsPerFrame =
(maxPacketsPerFrame * partialReadout) / maxRows;
(maxPacketsPerFrame * readNRows) / maxRows;
LOG(logDEBUG1,
@ -2419,7 +2419,7 @@ void *start_timer(void *arg) {
// loop packet
for (int i = 0; i != maxPacketsPerFrame; ++i) {
// calculate for partial readout
// calculate for readNRows
const int startval = 0;
const int endval = startval + packetsPerFrame - 1;

View File

@ -167,13 +167,13 @@
#define ADC_PORT_INVERT_ADC_3_OFST (24)
#define ADC_PORT_INVERT_ADC_3_MSK (0x000000FF << ADC_PORT_INVERT_ADC_3_OFST)
/** Partial Readout Register */
#define PARTIAL_READOUT_REG (0x44 << MEM_MAP_SHIFT)
/** Read N Rows Register */
#define READ_N_ROWS_REG (0x44 << MEM_MAP_SHIFT)
#define PARTIAL_READOUT_NUM_ROWS_OFST (0)
#define PARTIAL_READOUT_NUM_ROWS_MSK (0x0000003F << PARTIAL_READOUT_NUM_ROWS_OFST)
#define PARTIAL_READOUT_ENBL_OFST (7)
#define PARTIAL_READOUT_ENBL_MSK (0x00000001 << PARTIAL_READOUT_ENBL_OFST)
#define READ_N_ROWS_NUM_ROWS_OFST (0)
#define READ_N_ROWS_NUM_ROWS_MSK (0x0000003F << READ_N_ROWS_NUM_ROWS_OFST)
#define READ_N_ROWS_ENBL_OFST (7)
#define READ_N_ROWS_ENBL_MSK (0x00000001 << READ_N_ROWS_ENBL_OFST)
/* Configuration Register */

View File

@ -52,9 +52,6 @@ int detPos[4] = {};
int chipVersion = 10; // (1.0)
int chipConfigured = 0;
// until firmware is done
int temp_partialReadout = 512;
int isInitCheckDone() { return initCheckDone; }
int getInitResult(char **mess) {
@ -485,7 +482,7 @@ void setupDetector() {
setFilterCell(DEFAULT_FILTER_CELL);
}
disableCurrentSource();
setPartialReadout(MAX_ROWS_PER_READOUT);
setReadNRows(MAX_ROWS_PER_READOUT);
}
int resetToDefaultDacs(int hardReset) {
@ -1636,45 +1633,39 @@ int *getDetectorPosition() { return detPos; }
/* jungfrau specific - powerchip, autocompdisable, asictimer, clockdiv, pll,
* flashing fpga */
int setPartialReadout(int value) {
if (value < 0 || (value % PARTIAL_READOUT_MULTIPLE != 0))
int setReadNRows(int value) {
if (value < 0 || (value % READ_N_ROWS_MULTIPLE != 0)) {
LOG(logERROR, ("Invalid number of rows %d\n", value));
return FAIL;
// will be replaced when firmware is fixed
temp_partialReadout = value;
return OK;
}
// regval is numpackets - 1
int regval = (value / PARTIAL_READOUT_MULTIPLE) - 1;
uint32_t addr = PARTIAL_READOUT_REG;
LOG(logINFO, ("Setting Partial Readout: %d (regval:%d)\n", value, regval));
bus_w(addr, bus_r(addr) &~PARTIAL_READOUT_NUM_ROWS_MSK);
bus_w(addr, bus_r(addr) | ((regval << PARTIAL_READOUT_NUM_ROWS_OFST) & PARTIAL_READOUT_NUM_ROWS_MSK));
int regval = (value / READ_N_ROWS_MULTIPLE) - 1;
uint32_t addr = READ_N_ROWS_REG;
LOG(logINFO, ("Setting number of rows: %d (regval:%d)\n", value, regval));
bus_w(addr, bus_r(addr) &~READ_N_ROWS_NUM_ROWS_MSK);
bus_w(addr, bus_r(addr) | ((regval << READ_N_ROWS_NUM_ROWS_OFST) & READ_N_ROWS_NUM_ROWS_MSK));
if (value == MAX_ROWS_PER_READOUT) {
LOG(logINFO, ("Disabling Partial Readout\n"));
bus_w(addr, bus_r(addr) &~PARTIAL_READOUT_ENBL_MSK);
LOG(logINFO, ("Disabling Partial Readout (#rows)\n"));
bus_w(addr, bus_r(addr) &~READ_N_ROWS_ENBL_MSK);
} else {
LOG(logINFO, ("Enabling Partial Readout\n"));
bus_w(addr, bus_r(addr) | PARTIAL_READOUT_ENBL_MSK);
LOG(logINFO, ("Enabling Partial Readout (#rows)\n"));
bus_w(addr, bus_r(addr) | READ_N_ROWS_ENBL_MSK);
}
return OK;
}
int getPartialReadout() {
// will be replaced when firmware is fixed
return temp_partialReadout;
int enable = (bus_r(PARTIAL_READOUT_REG) & PARTIAL_READOUT_ENBL_MSK);
int regval = ((bus_r(PARTIAL_READOUT_REG) & PARTIAL_READOUT_NUM_ROWS_MSK) >> PARTIAL_READOUT_NUM_ROWS_OFST);
int getReadNRows() {
int enable = (bus_r(READ_N_ROWS_REG) & READ_N_ROWS_ENBL_MSK);
int regval = ((bus_r(READ_N_ROWS_REG) & READ_N_ROWS_NUM_ROWS_MSK) >> READ_N_ROWS_NUM_ROWS_OFST);
int maxRegval = (MAX_ROWS_PER_READOUT/ PARTIAL_READOUT_MULTIPLE) - 1;
int maxRegval = (MAX_ROWS_PER_READOUT/ READ_N_ROWS_MULTIPLE) - 1;
if ((regval == maxRegval && enable) || (regval != maxRegval && !enable)) {
return -1;
}
return (regval + 1) * PARTIAL_READOUT_MULTIPLE;
return (regval + 1) * READ_N_ROWS_MULTIPLE;
}
void initReadoutConfiguration() {
@ -2354,14 +2345,14 @@ void *start_timer(void *arg) {
const int packetsize = dataSize + sizeof(sls_detector_header);
const int maxPacketsPerFrame = 128;
const int maxRows = MAX_ROWS_PER_READOUT;
int partialReadout = getPartialReadout();
if (partialReadout == -1) {
int readNRows = getReadNRows();
if (readNRows == -1) {
LOG(logERROR,
("partial readout is -1. Assuming no partial readout.\n"));
partialReadout = MAX_ROWS_PER_READOUT;
("number of rows is -1. Assuming no partial readout (#rows).\n"));
readNRows = MAX_ROWS_PER_READOUT;
}
const int packetsPerFrame =
((maxPacketsPerFrame / 2) * partialReadout) / (maxRows / 2);
((maxPacketsPerFrame / 2) * readNRows) / (maxRows / 2);
// Generate data
char imageData[DATA_BYTES];

View File

@ -116,7 +116,7 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
#define MAX_FILTER_CELL_VAL (12)
#define MIN_ROWS_PER_READOUT (8)
#define MAX_ROWS_PER_READOUT (512)
#define PARTIAL_READOUT_MULTIPLE (8) //512 rows/128packets * 2 interfaces
#define READ_N_ROWS_MULTIPLE (8) //512 rows/128packets * 2 interfaces
/* Defines in the Firmware */
#define MAX_TIMESLOT_VAL (0x1F)

View File

@ -417,8 +417,8 @@ int setQuad(int value);
int getQuad();
int setInterruptSubframe(int value);
int getInterruptSubframe();
int setPartialReadout(int value);
int getPartialReadout();
int setReadNRows(int value);
int getReadNRows();
#endif
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(EIGERD) || \
defined(MYTHEN3D)
@ -457,8 +457,8 @@ void setDigitalIODelay(uint64_t pinMask, int delay);
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock,
// pll, flashing firmware
#ifdef JUNGFRAUD
int setPartialReadout(int value);
int getPartialReadout();
int setReadNRows(int value);
int getReadNRows();
void initReadoutConfiguration();
int powerChip(int on);
int isChipConfigured();

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_partial_readout(int);
int get_partial_readout(int);
int set_read_n_rows(int);
int get_read_n_rows(int);
void calculate_and_set_position();
int set_detector_position(int);
int check_detector_idle(const char *s);

View File

@ -284,8 +284,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_PARTIAL_READOUT] = &set_partial_readout;
flist[F_GET_PARTIAL_READOUT] = &get_partial_readout;
flist[F_SET_READ_N_ROWS] = &set_read_n_rows;
flist[F_GET_READ_N_ROWS] = &get_read_n_rows;
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;
@ -4741,14 +4741,14 @@ int get_interrupt_subframe(int file_des) {
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int set_partial_readout(int file_des) {
int set_read_n_rows(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(logDEBUG1, ("Setting partial readout: %u\n", arg));
LOG(logDEBUG1, ("Setting number of rows: %u\n", arg));
#if !defined(EIGERD) && !defined(JUNGFRAUD)
functionNotImplemented();
@ -4758,7 +4758,7 @@ int set_partial_readout(int file_des) {
if (arg <= 0 || arg > MAX_ROWS_PER_READOUT) {
ret = FAIL;
sprintf(mess,
"Could not set partial readout. Must be between %d "
"Could not set read n rows. Must be between %d "
"and %d\n",
MIN_ROWS_PER_READOUT, MAX_ROWS_PER_READOUT);
LOG(logERROR, (mess));
@ -4771,7 +4771,7 @@ int set_partial_readout(int file_des) {
if ((arg * maxnp) % maxnl) {
ret = FAIL;
sprintf(mess,
"Could not set %d partial readout. For %d bit "
"Could not set number of rows to %d. For %d bit "
"mode and 10 giga %s, (%d (num "
"rows) x %d (max num packets for this mode)) must be "
"divisible by %d\n",
@ -4780,26 +4780,26 @@ int set_partial_readout(int file_des) {
LOG(logERROR, (mess));
} else
#elif JUNGFRAUD
if ((check_detector_idle("set partial readout") == OK) && (arg % PARTIAL_READOUT_MULTIPLE != 0)) {
if ((check_detector_idle("set nmber of rows") == OK) && (arg % READ_N_ROWS_MULTIPLE != 0)) {
ret = FAIL;
sprintf(mess,
"Could not set partial readout. %d must be a multiple "
"Could not set number of rows. %d must be a multiple "
"of %d\n",
arg, PARTIAL_READOUT_MULTIPLE);
arg, READ_N_ROWS_MULTIPLE);
LOG(logERROR, (mess));
} else
#endif
{
if (setPartialReadout(arg) == FAIL) {
if (setReadNRows(arg) == FAIL) {
ret = FAIL;
sprintf(mess, "Could not set partial readout to %d.\n", arg);
sprintf(mess, "Could not set number of rows to %d.\n", arg);
LOG(logERROR, (mess));
} else {
int retval = getPartialReadout();
int retval = getReadNRows();
if (arg != retval) {
ret = FAIL;
sprintf(mess,
"Could not set partial readout. Set %d, but "
"Could not set number of rows. Set %d, but "
"read %d\n",
retval, arg);
LOG(logERROR, (mess));
@ -4812,24 +4812,24 @@ int set_partial_readout(int file_des) {
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_partial_readout(int file_des) {
int get_read_n_rows(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
LOG(logDEBUG1, ("Getting partial readout\n"));
LOG(logDEBUG1, ("Getting number of rows\n"));
#if !defined(EIGERD) && !defined(JUNGFRAUD)
functionNotImplemented();
#else
// get only
retval = getPartialReadout();
retval = getReadNRows();
if (retval == -1) {
ret = FAIL;
sprintf(mess, "Could not get partial readout. \n");
sprintf(mess, "Could not get numbr of rows. \n");
LOG(logERROR, (mess));
} else {
LOG(logDEBUG1, ("Partial readout retval: %u\n", retval));
LOG(logDEBUG1, ("number of rows retval: %u\n", retval));
}
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
@ -7211,9 +7211,9 @@ int get_receiver_parameters(int file_des) {
if (n < 0)
return printSocketReadError();
// partialReadout
// ReadNRows
#if defined(EIGERD) || defined(JUNGFRAUD)
i32 = getPartialReadout();
i32 = getReadNRows();
#else
i32 = 0;
#endif

View File

@ -510,13 +510,13 @@ class Detector {
void setDBITPipeline(int value, Positions pos = {});
/** [Eiger][Jungfrau] */
Result<int> getPartialReadout(Positions pos = {}) const;
Result<int> getReadNRows(Positions pos = {}) const;
/** [Eiger] Number of lines to read out per half module
/** [Eiger] Number of rows to read out per half module
* Options: 0 - 256. 256 is default. The permissible values depend on
* dynamic range and 10Gbe enabled. \n[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512.
*/
void setPartialReadout(const int lines, Positions pos = {});
void setReadNRows(const int lines, Positions pos = {});
///@{

View File

@ -593,7 +593,7 @@ class CmdProxy {
{"vhighvoltage", "highvoltage"},
{"digitest", "imagetest"},
{"filter", "filterresistor"},
{"readnlines", "partialread"},
{"readnlines", "readnrows"},
/** temperature */
@ -807,7 +807,7 @@ class CmdProxy {
{"filterresistor", &CmdProxy::filterresistor},
{"currentsource", &CmdProxy::CurrentSource},
{"dbitpipeline", &CmdProxy::dbitpipeline},
{"partialread", &CmdProxy::partialread},
{"readnrows", &CmdProxy::readnrows},
/** temperature */
{"templist", &CmdProxy::templist},
@ -1376,7 +1376,7 @@ class CmdProxy {
"Options: 0-7\n\t[CTB] Options: 0-255");
INTEGER_COMMAND_VEC_ID(
partialread, getPartialReadout, setPartialReadout, StringTo<int>,
readnrows, getReadNRows, setReadNRows, 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.\n[8-512 (multiple of 8)]\n\t[Jungfrau] Number of rows per module starting from the centre. Options: 8 - 512, must be multiples of 8. Default is 512.");

View File

@ -732,12 +732,12 @@ void Detector::setDBITPipeline(int value, Positions pos) {
pimpl->Parallel(&Module::setDBITPipeline, pos, value);
}
Result<int> Detector::getPartialReadout(Positions pos) const {
return pimpl->Parallel(&Module::getPartialReadout, pos);
Result<int> Detector::getReadNRows(Positions pos) const {
return pimpl->Parallel(&Module::getReadNRows, pos);
}
void Detector::setPartialReadout(const int lines, Positions pos) {
pimpl->Parallel(&Module::setPartialReadout, pos, lines);
void Detector::setReadNRows(const int lines, Positions pos) {
pimpl->Parallel(&Module::setReadNRows, pos, lines);
}
// Acquisition

View File

@ -734,14 +734,14 @@ void Module::setDBITPipeline(int value) {
sendToDetector(F_SET_DBIT_PIPELINE, value, nullptr);
}
int Module::getPartialReadout() const {
return sendToDetector<int>(F_GET_PARTIAL_READOUT);
int Module::getReadNRows() const {
return sendToDetector<int>(F_GET_READ_N_ROWS);
}
void Module::setPartialReadout(const int value) {
sendToDetector(F_SET_PARTIAL_READOUT, value, nullptr);
void Module::setReadNRows(const int value) {
sendToDetector(F_SET_READ_N_ROWS, value, nullptr);
if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_RECEIVER_PARTIAL_READOUT, value, nullptr);
sendToReceiver(F_SET_RECEIVER_READ_N_ROWS, value, nullptr);
}
}

View File

@ -178,8 +178,8 @@ class Module : public virtual slsDetectorDefs {
void setCurrentSource(defs::currentSrcParameters par);
int getDBITPipeline() const;
void setDBITPipeline(int value);
int getPartialReadout() const;
void setPartialReadout(const int value);
int getReadNRows() const;
void setReadNRows(const int value);
/**************************************************
* *
* Acquisition *

View File

@ -1494,40 +1494,40 @@ TEST_CASE("dbitpipeline", "[.cmd]") {
}
}
TEST_CASE("partialread", "[.cmd]") {
TEST_CASE("readnrows", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::EIGER || det_type == defs::JUNGFRAU) {
auto prev_val = det.getPartialReadout();
auto prev_val = det.getReadNRows();
{
std::ostringstream oss;
proxy.Call("partialread", {"256"}, -1, PUT, oss);
REQUIRE(oss.str() == "partialread 256\n");
proxy.Call("readnrows", {"256"}, -1, PUT, oss);
REQUIRE(oss.str() == "readnrows 256\n");
}
{
std::ostringstream oss;
proxy.Call("partialread", {}, -1, GET, oss);
REQUIRE(oss.str() == "partialread 256\n");
proxy.Call("readnrows", {}, -1, GET, oss);
REQUIRE(oss.str() == "readnrows 256\n");
}
{
std::ostringstream oss;
proxy.Call("partialread", {"16"}, -1, PUT, oss);
REQUIRE(oss.str() == "partialread 16\n");
proxy.Call("readnrows", {"16"}, -1, PUT, oss);
REQUIRE(oss.str() == "readnrows 16\n");
}
if (det_type == defs::JUNGFRAU) {
REQUIRE_THROWS(proxy.Call("partialread", {"7"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("partialread", {"20"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("partialread", {"44"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("partialread", {"513"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("partialread", {"1"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("readnrows", {"7"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("readnrows", {"20"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("readnrows", {"44"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("readnrows", {"513"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("readnrows", {"1"}, -1, PUT));
}
REQUIRE_THROWS(proxy.Call("partialread", {"0"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("readnrows", {"0"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setPartialReadout(prev_val[i], {i});
det.setReadNRows(prev_val[i], {i});
}
} else {
REQUIRE_THROWS(proxy.Call("partialread", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("readnrows", {}, -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_PARTIAL_READOUT] = &ClientInterface::set_partial_readout;
flist[F_SET_RECEIVER_READ_N_ROWS] = &ClientInterface::set_read_n_rows;
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;
@ -417,7 +417,7 @@ int ClientInterface::setup_receiver(Interface &socket) {
impl()->setThresholdEnergy(arg.thresholdEnergyeV[0]);
}
if (myDetectorType == EIGER || myDetectorType == JUNGFRAU) {
impl()->setPartialReadout(arg.partialReadout);
impl()->setReadNRows(arg.readNRows);
}
if (myDetectorType == MYTHEN3) {
std::array<int, 3> val;
@ -1406,19 +1406,19 @@ int ClientInterface::set_quad_type(Interface &socket) {
return socket.Send(OK);
}
int ClientInterface::set_partial_readout(Interface &socket) {
int ClientInterface::set_read_n_rows(Interface &socket) {
auto arg = socket.Receive<int>();
if (arg >= 0) {
verifyIdle(socket);
if (myDetectorType != EIGER && myDetectorType != JUNGFRAU) {
throw RuntimeError("Could not set partial readout. Not implemented for this detector");
throw RuntimeError("Could not set number of rows. Not implemented for this detector");
}
LOG(logDEBUG1) << "Setting Partial Readout:" << arg;
impl()->setPartialReadout(arg);
LOG(logDEBUG1) << "Setting number of rows:" << arg;
impl()->setReadNRows(arg);
}
int retval = impl()->getPartialReadout();
validate(arg, retval, "set partial readout", DEC);
LOG(logDEBUG1) << "read partial readout:" << retval;
int retval = impl()->getReadNRows();
validate(arg, retval, "set number of rows", DEC);
LOG(logDEBUG1) << "read number of rows:" << 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_partial_readout(sls::ServerInterface &socket);
int set_read_n_rows(sls::ServerInterface &socket);
sls::MacAddr setUdpIp(sls::IpAddr arg);
int set_udp_ip(sls::ServerInterface &socket);
sls::MacAddr setUdpIp2(sls::IpAddr arg);

View File

@ -476,9 +476,9 @@ std::vector<uint64_t> Implementation::getNumMissingPackets() const {
for (int i = 0; i < numThreads; i++) {
int np = generalData->packetsPerFrame;
uint64_t totnp = np;
// partial readout
if (partialReadout != (int)generalData->maxRowsPerReadout) {
totnp = ((partialReadout * np) / generalData->maxRowsPerReadout);
// ReadNRows
if (readNRows != (int)generalData->maxRowsPerReadout) {
totnp = ((readNRows * np) / generalData->maxRowsPerReadout);
}
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->partialReadout = partialReadout;
masterAttributes->readNRows = readNRows;
masterAttributes->ratecorr = rateCorrections;
masterAttributes->adcmask =
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga;
@ -1533,11 +1533,11 @@ void Implementation::setDeactivatedPadding(bool enable) {
<< (deactivatedPaddingEnable ? "enabled" : "disabled");
}
int Implementation::getPartialReadout() const { return partialReadout; }
int Implementation::getReadNRows() const { return readNRows; }
void Implementation::setPartialReadout(const int value) {
partialReadout = value;
LOG(logINFO) << "Partial readout (#rows): " << partialReadout;
void Implementation::setReadNRows(const int value) {
readNRows = value;
LOG(logINFO) << "Number of rows: " << readNRows;
}
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 getPartialReadout() const;
int getReadNRows() const;
/* [Eiger][Jungfrau] */
void setPartialReadout(const int value);
void setReadNRows(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 partialReadout{0};
int readNRows{0};
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 partialReadout;
uint32_t readNRows;
std::vector<int64_t> ratecorr;
uint32_t adcmask{0};
uint32_t analog{0};
@ -337,7 +337,7 @@ class JungfrauMasterAttributes : public MasterAttributes {
<< "Exptime : " << sls::ToString(exptime) << '\n'
<< "Period : " << sls::ToString(period) << '\n'
<< "Number of UDP Interfaces : " << numUDPInterfaces << '\n'
<< "Partial Readout (rows) : " << partialReadout << '\n';
<< "Number of rows : " << readNRows << '\n';
std::string message = oss.str();
MasterAttributes::WriteBinaryAttributes(fd, message);
};
@ -353,12 +353,12 @@ class JungfrauMasterAttributes : public MasterAttributes {
"Number of UDP Interfaces", PredType::NATIVE_INT, dataspace);
dataset.write(&numUDPInterfaces, PredType::NATIVE_INT);
}
// partialReadout
// readNRows
{
DataSpace dataspace = DataSpace(H5S_SCALAR);
DataSet dataset = group->createDataSet(
"Partial readout (rows)", PredType::NATIVE_INT, dataspace);
dataset.write(&partialReadout, PredType::NATIVE_INT);
"Number of rows", PredType::NATIVE_INT, dataspace);
dataset.write(&readNRows, PredType::NATIVE_INT);
}
};
#endif
@ -381,7 +381,7 @@ class EigerMasterAttributes : public MasterAttributes {
<< "SubPeriod : " << sls::ToString(subPeriod)
<< '\n'
<< "Quad : " << quad << '\n'
<< "Partial Readout (rows) : " << partialReadout << '\n'
<< "Number of rows : " << readNRows << '\n'
<< "Rate Corrections : " << sls::ToString(ratecorr)
<< '\n';
std::string message = oss.str();
@ -435,12 +435,12 @@ class EigerMasterAttributes : public MasterAttributes {
group->createDataSet("Quad", PredType::NATIVE_INT, dataspace);
dataset.write(&quad, PredType::NATIVE_INT);
}
// partialReadout
// readNRows
{
DataSpace dataspace = DataSpace(H5S_SCALAR);
DataSet dataset = group->createDataSet(
"Partial readout (rows)", PredType::NATIVE_INT, dataspace);
dataset.write(&partialReadout, PredType::NATIVE_INT);
"Number of rows", PredType::NATIVE_INT, dataspace);
dataset.write(&readNRows, PredType::NATIVE_INT);
}
// Rate corrections
{

View File

@ -523,7 +523,7 @@ typedef struct {
int dataStreamLeft{0};
int dataStreamRight{0};
int quad{0};
int partialReadout{0};
int readNRows{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_PARTIAL_READOUT,
F_GET_PARTIAL_READOUT,
F_SET_READ_N_ROWS,
F_GET_READ_N_ROWS,
F_SET_POSITION,
F_SET_SOURCE_UDP_MAC,
F_GET_SOURCE_UDP_MAC,
@ -332,7 +332,7 @@ enum detFuncs {
F_SET_RECEIVER_DBIT_OFFSET,
F_GET_RECEIVER_DBIT_OFFSET,
F_SET_RECEIVER_QUAD,
F_SET_RECEIVER_PARTIAL_READOUT,
F_SET_RECEIVER_READ_N_ROWS,
F_SET_RECEIVER_UDP_IP,
F_SET_RECEIVER_UDP_IP2,
F_SET_RECEIVER_UDP_PORT,
@ -483,8 +483,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_PARTIAL_READOUT: return "F_SET_PARTIAL_READOUT";
case F_GET_PARTIAL_READOUT: return "F_GET_PARTIAL_READOUT";
case F_SET_READ_N_ROWS: return "F_SET_READ_N_ROWS";
case F_GET_READ_N_ROWS: return "F_GET_READ_N_ROWS";
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";
@ -689,7 +689,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_PARTIAL_READOUT: return "F_SET_RECEIVER_PARTIAL_READOUT";
case F_SET_RECEIVER_READ_N_ROWS: return "F_SET_RECEIVER_READ_N_ROWS";
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

@ -1,11 +1,9 @@
/** API versions */
#define GITBRANCH "roundrobin"
#define APILIB 0x210831
#define APIRECEIVER 0x210831
#define APIGUI 0x210819
#define APICTB 0x210907
#define APIGOTTHARD 0x210907
#define APIGOTTHARD2 0x210907

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
<< "partialReadout:" << r.partialReadout << std::endl
<< "readNRows:" << r.readNRows << std::endl
<< "thresholdEnergyeV:" << ToString(r.thresholdEnergyeV) << std::endl
<< "dynamicRange:" << r.dynamicRange << std::endl
<< "timMode:" << r.timMode << std::endl