mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
commit
3d90c1527a
@ -73,6 +73,11 @@ vetoalg
|
|||||||
vetostream
|
vetostream
|
||||||
serialnumber (put)
|
serialnumber (put)
|
||||||
dbitpipeline
|
dbitpipeline
|
||||||
|
readnlines->partialread
|
||||||
|
|
||||||
|
setting number of udp interfaces from 1 to 2, didnt get image in gui
|
||||||
|
|
||||||
|
virtual server plots increasing values for every packet.. not every pixel
|
||||||
|
|
||||||
3. Firmware Requirements
|
3. Firmware Requirements
|
||||||
========================
|
========================
|
||||||
|
@ -488,7 +488,7 @@ TEST_CASE("Eiger or Jungfrau nextframenumber",
|
|||||||
CHECK(m.getNextFrameNumber() == (val + 1));
|
CHECK(m.getNextFrameNumber() == (val + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
|
TEST_CASE("Eiger partialread", "[.eigerintegration][partialread]") {
|
||||||
SingleDetectorConfig c;
|
SingleDetectorConfig c;
|
||||||
|
|
||||||
// pick up multi detector from shm id 0
|
// pick up multi detector from shm id 0
|
||||||
@ -501,16 +501,16 @@ TEST_CASE("Eiger readnlines", "[.eigerintegration][readnlines]") {
|
|||||||
|
|
||||||
m.setDynamicRange(16);
|
m.setDynamicRange(16);
|
||||||
m.enableTenGigabitEthernet(0);
|
m.enableTenGigabitEthernet(0);
|
||||||
m.setReadNLines(256);
|
m.setPartialReadout(256);
|
||||||
CHECK(m.getReadNLines() == 256);
|
CHECK(m.getPartialReadout() == 256);
|
||||||
m.setReadNLines(1);
|
m.setPartialReadout(1);
|
||||||
CHECK(m.getReadNLines() == 1);
|
CHECK(m.getPartialReadout() == 1);
|
||||||
|
|
||||||
m.setDynamicRange(8);
|
m.setDynamicRange(8);
|
||||||
m.setReadNLines(256);
|
m.setPartialReadout(256);
|
||||||
CHECK(m.getReadNLines() == 256);
|
CHECK(m.getPartialReadout() == 256);
|
||||||
CHECK_THROWS_AS(m.setReadNLines(1), sls::RuntimeError);
|
CHECK_THROWS_AS(m.setPartialReadout(1), sls::RuntimeError);
|
||||||
CHECK(m.getReadNLines() == 256);
|
CHECK(m.getPartialReadout() == 256);
|
||||||
CHECK_THROWS_AS(m.setReadNLines(0), sls::RuntimeError);
|
CHECK_THROWS_AS(m.setPartialReadout(0), sls::RuntimeError);
|
||||||
m.setReadNLines(256);
|
m.setPartialReadout(256);
|
||||||
}
|
}
|
@ -1846,18 +1846,20 @@ class Detector(CppDetectorApi):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@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 starting from the centre.
|
||||||
|
[Jungfrau] Number of rows to read per module starting from the centre.
|
||||||
Note
|
Note
|
||||||
----
|
----
|
||||||
Options: 0 - 256. 256 is default. \n
|
[Eiger] Options: 1 - 256. 256 is default. \n
|
||||||
The permissible values depend on dynamic range and 10Gbe enabled.
|
[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.getPartialReadout()
|
||||||
|
|
||||||
@readnlines.setter
|
@partialread.setter
|
||||||
def readnlines(self, value):
|
def partialread(self, value):
|
||||||
ut.set_using_dict(self.setPartialReadout, value)
|
ut.set_using_dict(self.setPartialReadout, value)
|
||||||
|
|
||||||
|
|
||||||
|
@ -473,7 +473,6 @@ void qTabSettings::Refresh() {
|
|||||||
GetThresholdEnergies();
|
GetThresholdEnergies();
|
||||||
// eiger
|
// eiger
|
||||||
else if (spinThreshold->isEnabled()) {
|
else if (spinThreshold->isEnabled()) {
|
||||||
LOG(logINFOBLUE) << "calling it!";
|
|
||||||
GetThresholdEnergy();
|
GetThresholdEnergy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
@ -38,7 +38,7 @@ int Beb_top = 0;
|
|||||||
uint64_t Beb_deactivatedNextFrameNumber = 0;
|
uint64_t Beb_deactivatedNextFrameNumber = 0;
|
||||||
int Beb_quadEnable = 0;
|
int Beb_quadEnable = 0;
|
||||||
int Beb_positions[2] = {0, 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_flowcontrol_10g = 0;
|
||||||
int Beb_deactivated_transmission_delay_frame = 0;
|
int Beb_deactivated_transmission_delay_frame = 0;
|
||||||
int Beb_deactivated_transmission_delay_left = 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 maxnl = MAX_ROWS_PER_READOUT;
|
||||||
unsigned int maxnp = (ten_gig ? 4 : 16) * Beb_bit_mode;
|
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;
|
unsigned int npackets = (nl * maxnp) / maxnl;
|
||||||
if ((nl * maxnp) % maxnl) {
|
if ((nl * maxnp) % maxnl) {
|
||||||
LOG(logERROR, ("Read N Lines is incorrect. Switching to Full Image "
|
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;
|
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); }
|
uint16_t Beb_swap_uint16(uint16_t val) { return (val << 8) | (val >> 8); }
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ int Beb_SetDetectorPosition(int pos[]);
|
|||||||
int Beb_SetNextFrameNumber(uint64_t value);
|
int Beb_SetNextFrameNumber(uint64_t value);
|
||||||
int Beb_GetNextFrameNumber(uint64_t *retval, int tengigaEnable);
|
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);
|
uint16_t Beb_swap_uint16(uint16_t val);
|
||||||
int Beb_open(u_int32_t **csp0base, u_int32_t offset);
|
int Beb_open(u_int32_t **csp0base, u_int32_t offset);
|
||||||
|
@ -1554,24 +1554,24 @@ int Feb_Control_SetChipSignalsToTrimQuad(int enable) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_SetReadNLines(int value) {
|
int Feb_Control_SetPartialReadout(int value) {
|
||||||
LOG(logINFO, ("Setting Read N Lines to %d\n", value));
|
LOG(logINFO, ("Setting Partial Readout to %d\n", value));
|
||||||
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
if (!Feb_Interface_WriteRegister(Feb_Control_AddressToAll(),
|
||||||
DAQ_REG_PARTIAL_READOUT, value, 0, 0)) {
|
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 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Control_GetReadNLines() {
|
int Feb_Control_GetPartialReadout() {
|
||||||
uint32_t regVal = 0;
|
uint32_t regVal = 0;
|
||||||
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
if (!Feb_Interface_ReadRegister(Feb_Control_AddressToAll(),
|
||||||
DAQ_REG_PARTIAL_READOUT, ®Val)) {
|
DAQ_REG_PARTIAL_READOUT, ®Val)) {
|
||||||
LOG(logERROR, ("Could not read back read n lines reg\n"));
|
LOG(logERROR, ("Could not read back Partial Readout reg\n"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
LOG(logDEBUG1, ("Retval read n lines: %d\n", regVal));
|
LOG(logDEBUG1, ("Retval Partial Readout: %d\n", regVal));
|
||||||
return regVal;
|
return regVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,8 +88,8 @@ void Feb_Control_SetMasterVariable(int val);
|
|||||||
int Feb_Control_SetMaster(enum MASTERINDEX ind);
|
int Feb_Control_SetMaster(enum MASTERINDEX ind);
|
||||||
int Feb_Control_SetQuad(int val);
|
int Feb_Control_SetQuad(int val);
|
||||||
int Feb_Control_SetChipSignalsToTrimQuad(int enable);
|
int Feb_Control_SetChipSignalsToTrimQuad(int enable);
|
||||||
int Feb_Control_SetReadNLines(int value);
|
int Feb_Control_SetPartialReadout(int value);
|
||||||
int Feb_Control_GetReadNLines();
|
int Feb_Control_GetPartialReadout();
|
||||||
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
|
int Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
|
||||||
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);
|
int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval);
|
||||||
|
|
||||||
|
Binary file not shown.
@ -88,7 +88,7 @@ uint64_t eiger_virtual_nextframenumber = 1;
|
|||||||
int eiger_virtual_detPos[2] = {0, 0};
|
int eiger_virtual_detPos[2] = {0, 0};
|
||||||
int eiger_virtual_test_mode = 0;
|
int eiger_virtual_test_mode = 0;
|
||||||
int eiger_virtual_quad_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_interrupt_subframe = 0;
|
||||||
int eiger_virtual_left_datastream = 1;
|
int eiger_virtual_left_datastream = 1;
|
||||||
int eiger_virtual_right_datastream = 1;
|
int eiger_virtual_right_datastream = 1;
|
||||||
@ -708,7 +708,7 @@ void setupDetector() {
|
|||||||
setIODelay(DEFAULT_IO_DELAY);
|
setIODelay(DEFAULT_IO_DELAY);
|
||||||
setTiming(DEFAULT_TIMING_MODE);
|
setTiming(DEFAULT_TIMING_MODE);
|
||||||
setNextFrameNumber(DEFAULT_STARTING_FRAME_NUMBER);
|
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);
|
// SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15);
|
||||||
eiger_tau_ns = DEFAULT_RATE_CORRECTION;
|
eiger_tau_ns = DEFAULT_RATE_CORRECTION;
|
||||||
setRateCorrection(DEFAULT_RATE_CORRECTION);
|
setRateCorrection(DEFAULT_RATE_CORRECTION);
|
||||||
@ -1671,29 +1671,29 @@ int getInterruptSubframe() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int setReadNLines(int value) {
|
int setPartialReadout(int value) {
|
||||||
if (value < 0)
|
if (value < 0)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
sharedMemory_lockLocalLink();
|
sharedMemory_lockLocalLink();
|
||||||
if (!Feb_Control_SetReadNLines(value)) {
|
if (!Feb_Control_SetPartialReadout(value)) {
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
Beb_SetReadNLines(value);
|
Beb_SetPartialReadout(value);
|
||||||
#else
|
#else
|
||||||
eiger_virtual_read_nlines = value;
|
eiger_virtual_partial_readout = value;
|
||||||
#endif
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getReadNLines() {
|
int getPartialReadout() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return eiger_virtual_read_nlines;
|
return eiger_virtual_partial_readout;
|
||||||
#else
|
#else
|
||||||
sharedMemory_lockLocalLink();
|
sharedMemory_lockLocalLink();
|
||||||
int retval = Feb_Control_GetReadNLines();
|
int retval = Feb_Control_GetPartialReadout();
|
||||||
sharedMemory_unlockLocalLink();
|
sharedMemory_unlockLocalLink();
|
||||||
return retval;
|
return retval;
|
||||||
#endif
|
#endif
|
||||||
@ -2306,57 +2306,77 @@ void *start_timer(void *arg) {
|
|||||||
int tgEnable = send_to_ten_gig;
|
int tgEnable = send_to_ten_gig;
|
||||||
int datasize = (tgEnable ? 4096 : 1024);
|
int datasize = (tgEnable ? 4096 : 1024);
|
||||||
int packetsize = datasize + sizeof(sls_detector_header);
|
int packetsize = datasize + sizeof(sls_detector_header);
|
||||||
int numPacketsPerFrame = (tgEnable ? 4 : 16) * dr;
|
int maxPacketsPerFrame = (tgEnable ? 4 : 16) * dr;
|
||||||
int npixelsx = 256 * 2 * bytesPerPixel;
|
int npixelsx = 256 * 2 * bytesPerPixel;
|
||||||
int databytes = 256 * 256 * 2 * bytesPerPixel;
|
int databytes = 256 * 256 * 2 * bytesPerPixel;
|
||||||
int row = eiger_virtual_detPos[0];
|
int row = eiger_virtual_detPos[0];
|
||||||
int colLeft = top ? eiger_virtual_detPos[1] : eiger_virtual_detPos[1] + 1;
|
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 colRight = top ? eiger_virtual_detPos[1] + 1 : eiger_virtual_detPos[1];
|
||||||
int ntotpixels = 256 * 256 * 4;
|
|
||||||
|
int partialReadout = getPartialReadout();
|
||||||
|
if (partialReadout == -1) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("partial readout is -1. Assuming no partial readout.\n"));
|
||||||
|
partialReadout = MAX_ROWS_PER_READOUT;
|
||||||
|
}
|
||||||
|
const int maxRows = MAX_ROWS_PER_READOUT;
|
||||||
|
const int packetsPerFrame =
|
||||||
|
(maxPacketsPerFrame * partialReadout) / maxRows;
|
||||||
|
|
||||||
|
|
||||||
LOG(logDEBUG1,
|
LOG(logDEBUG1,
|
||||||
(" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
|
(" dr:%d\n bytesperpixel:%f\n tgenable:%d\n datasize:%d\n "
|
||||||
"packetsize:%d\n numpackes:%d\n npixelsx:%d\n databytes:%d\n "
|
"packetsize:%d\n maxnumpackes:%d\n npixelsx:%d\n databytes:%d\n",
|
||||||
"ntotpixels:%d\n",
|
dr, bytesPerPixel, tgEnable, datasize, packetsize, maxPacketsPerFrame,
|
||||||
dr, bytesPerPixel, tgEnable, datasize, packetsize, numPacketsPerFrame,
|
npixelsx, databytes));
|
||||||
npixelsx, databytes, ntotpixels));
|
|
||||||
|
|
||||||
// Generate data
|
// Generate data
|
||||||
char imageData[databytes * 2];
|
char imageData[databytes * 2];
|
||||||
memset(imageData, 0, databytes * 2);
|
memset(imageData, 0, databytes * 2);
|
||||||
{
|
{
|
||||||
|
int npixels = NCHAN * NCHIP;
|
||||||
|
const int pixelsPerPacket = (double)datasize / bytesPerPixel;
|
||||||
|
int pixelVal = 0;
|
||||||
|
if (dr == 4) {
|
||||||
|
npixels /= 2;
|
||||||
|
}
|
||||||
|
LOG(logDBUG1,
|
||||||
|
("pixels:%d pixelsperpacket:%d\n", npixels, pixelsPerPacket));
|
||||||
|
for (int i = 0; i < npixels; ++i) {
|
||||||
|
if (i > 0 && i % pixelsPerPacket == 0) {
|
||||||
|
++pixelVal;
|
||||||
|
}
|
||||||
switch (dr) {
|
switch (dr) {
|
||||||
case 4:
|
case 4:
|
||||||
for (int i = 0; i < ntotpixels / 2; ++i) {
|
|
||||||
*((uint8_t *)(imageData + i)) =
|
*((uint8_t *)(imageData + i)) =
|
||||||
eiger_virtual_test_mode
|
eiger_virtual_test_mode
|
||||||
? 0xEE
|
? 0xEE
|
||||||
: (uint8_t)(((2 * i & 0xF) << 4) | ((2 * i + 1) & 0xF));
|
: (uint8_t)(((2 * pixelVal & 0xF) << 4) |
|
||||||
}
|
((2 * pixelVal) & 0xF));
|
||||||
|
//: (uint8_t)(((2 * pixelVal & 0xF) << 4) | ((2 * pixelVal + 1)
|
||||||
|
//& 0xF));
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
for (int i = 0; i < ntotpixels; ++i) {
|
|
||||||
*((uint8_t *)(imageData + i)) =
|
*((uint8_t *)(imageData + i)) =
|
||||||
eiger_virtual_test_mode ? 0xFE : (uint8_t)i;
|
eiger_virtual_test_mode ? 0xFE : (uint8_t)pixelVal;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
for (int i = 0; i < ntotpixels; ++i) {
|
|
||||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||||
eiger_virtual_test_mode ? 0xFFE : (uint16_t)i;
|
eiger_virtual_test_mode ? 0xFFE
|
||||||
}
|
: (uint16_t)pixelVal;
|
||||||
break;
|
break;
|
||||||
case 32:
|
case 32:
|
||||||
for (int i = 0; i < ntotpixels; ++i) {
|
|
||||||
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
||||||
eiger_virtual_test_mode ? 0xFFFFFE : (uint32_t)i;
|
eiger_virtual_test_mode ? 0xFFFFFE
|
||||||
}
|
: (uint32_t)pixelVal;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Send data
|
// Send data
|
||||||
if (!skipData) {
|
if (!skipData) {
|
||||||
uint64_t frameNr = 0;
|
uint64_t frameNr = 0;
|
||||||
@ -2381,7 +2401,13 @@ void *start_timer(void *arg) {
|
|||||||
int srcOffset2 = npixelsx;
|
int srcOffset2 = npixelsx;
|
||||||
|
|
||||||
// loop packet
|
// loop packet
|
||||||
for (int i = 0; i != numPacketsPerFrame; ++i) {
|
for (int i = 0; i != maxPacketsPerFrame; ++i) {
|
||||||
|
|
||||||
|
// calculate for partial readout
|
||||||
|
const int startval = 0;
|
||||||
|
const int endval = startval + packetsPerFrame - 1;
|
||||||
|
|
||||||
|
|
||||||
// set header
|
// set header
|
||||||
char packetData[packetsize];
|
char packetData[packetsize];
|
||||||
memset(packetData, 0, packetsize);
|
memset(packetData, 0, packetsize);
|
||||||
@ -2443,13 +2469,15 @@ void *start_timer(void *arg) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (eiger_virtual_left_datastream) {
|
if (eiger_virtual_left_datastream && i >= startval && i <= endval) {
|
||||||
usleep(eiger_virtual_transmission_delay_left);
|
usleep(eiger_virtual_transmission_delay_left);
|
||||||
sendUDPPacket(0, packetData, packetsize);
|
sendUDPPacket(0, packetData, packetsize);
|
||||||
|
LOG(logDEBUG1, ("Sent left packet: %d\n", i));
|
||||||
}
|
}
|
||||||
if (eiger_virtual_right_datastream) {
|
if (eiger_virtual_right_datastream && i >= startval && i <= endval) {
|
||||||
usleep(eiger_virtual_transmission_delay_right);
|
usleep(eiger_virtual_transmission_delay_right);
|
||||||
sendUDPPacket(1, packetData2, packetsize);
|
sendUDPPacket(1, packetData2, packetsize);
|
||||||
|
LOG(logDEBUG1, ("Sent right packet: %d\n", i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Sent frame: %d[%lld]\n", iframes,
|
LOG(logINFO, ("Sent frame: %d[%lld]\n", iframes,
|
||||||
|
@ -120,6 +120,7 @@ enum MASTERINDEX { MASTER_HARDWARE, OW_MASTER, OW_SLAVE };
|
|||||||
|
|
||||||
#define MAX_TRIMBITS_VALUE (63)
|
#define MAX_TRIMBITS_VALUE (63)
|
||||||
|
|
||||||
|
#define MIN_ROWS_PER_READOUT (1)
|
||||||
#define MAX_ROWS_PER_READOUT (256)
|
#define MAX_ROWS_PER_READOUT (256)
|
||||||
#define MAX_PACKETS_PER_REQUEST (256)
|
#define MAX_PACKETS_PER_REQUEST (256)
|
||||||
|
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -167,6 +167,15 @@
|
|||||||
#define ADC_PORT_INVERT_ADC_3_OFST (24)
|
#define ADC_PORT_INVERT_ADC_3_OFST (24)
|
||||||
#define ADC_PORT_INVERT_ADC_3_MSK (0x000000FF << ADC_PORT_INVERT_ADC_3_OFST)
|
#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)
|
||||||
|
|
||||||
|
#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)
|
||||||
|
|
||||||
|
|
||||||
/* Configuration Register */
|
/* Configuration Register */
|
||||||
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
|
#define CONFIG_REG (0x4D << MEM_MAP_SHIFT)
|
||||||
|
|
||||||
|
Binary file not shown.
@ -480,6 +480,7 @@ void setupDetector() {
|
|||||||
setFilterCell(DEFAULT_FILTER_CELL);
|
setFilterCell(DEFAULT_FILTER_CELL);
|
||||||
}
|
}
|
||||||
disableCurrentSource();
|
disableCurrentSource();
|
||||||
|
setPartialReadout(MAX_ROWS_PER_READOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int resetToDefaultDacs(int hardReset) {
|
int resetToDefaultDacs(int hardReset) {
|
||||||
@ -1596,6 +1597,39 @@ int *getDetectorPosition() { return detPos; }
|
|||||||
/* jungfrau specific - powerchip, autocompdisable, asictimer, clockdiv, pll,
|
/* jungfrau specific - powerchip, autocompdisable, asictimer, clockdiv, pll,
|
||||||
* flashing fpga */
|
* flashing fpga */
|
||||||
|
|
||||||
|
int setPartialReadout(int value) {
|
||||||
|
if (value < 0 || (value % PARTIAL_READOUT_MULTIPLE != 0))
|
||||||
|
return FAIL;
|
||||||
|
|
||||||
|
// 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));
|
||||||
|
|
||||||
|
if (value == MAX_ROWS_PER_READOUT) {
|
||||||
|
LOG(logINFO, ("Disabling Partial Readout\n"));
|
||||||
|
bus_w(addr, bus_r(addr) &~PARTIAL_READOUT_ENBL_MSK);
|
||||||
|
} else {
|
||||||
|
LOG(logINFO, ("Enabling Partial Readout\n"));
|
||||||
|
bus_w(addr, bus_r(addr) | PARTIAL_READOUT_ENBL_MSK);
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getPartialReadout() {
|
||||||
|
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 maxRegval = (MAX_ROWS_PER_READOUT/ PARTIAL_READOUT_MULTIPLE) - 1;
|
||||||
|
if ((regval == maxRegval && enable) || (regval != maxRegval && !enable)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (regval + 1) * PARTIAL_READOUT_MULTIPLE;
|
||||||
|
}
|
||||||
|
|
||||||
void initReadoutConfiguration() {
|
void initReadoutConfiguration() {
|
||||||
|
|
||||||
LOG(logINFO, ("Initializing Readout Configuration:\n"
|
LOG(logINFO, ("Initializing Readout Configuration:\n"
|
||||||
@ -2263,25 +2297,42 @@ void *start_timer(void *arg) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int transmissionDelayUs = getTransmissionDelayFrame() * 1000;
|
||||||
|
|
||||||
int numInterfaces = getNumberofUDPInterfaces();
|
int numInterfaces = getNumberofUDPInterfaces();
|
||||||
int64_t periodNs = getPeriod();
|
int64_t periodNs = getPeriod();
|
||||||
int numFrames = (getNumFrames() * getNumTriggers() *
|
int numFrames = (getNumFrames() * getNumTriggers() *
|
||||||
(getNumAdditionalStorageCells() + 1));
|
(getNumAdditionalStorageCells() + 1));
|
||||||
int64_t expUs = getExpTime() / 1000;
|
int64_t expUs = getExpTime() / 1000;
|
||||||
const int npixels = 256 * 256 * 8;
|
|
||||||
const int dataSize = 8192;
|
const int dataSize = 8192;
|
||||||
const int packetsize = dataSize + sizeof(sls_detector_header);
|
const int packetsize = dataSize + sizeof(sls_detector_header);
|
||||||
const int packetsPerFrame = numInterfaces == 1 ? 128 : 64;
|
const int maxPacketsPerFrame = 128;
|
||||||
int transmissionDelayUs = getTransmissionDelayFrame() * 1000;
|
const int maxRows = MAX_ROWS_PER_READOUT;
|
||||||
|
int partialReadout = getPartialReadout();
|
||||||
|
if (partialReadout == -1) {
|
||||||
|
LOG(logERROR,
|
||||||
|
("partial readout is -1. Assuming no partial readout.\n"));
|
||||||
|
partialReadout = MAX_ROWS_PER_READOUT;
|
||||||
|
}
|
||||||
|
const int packetsPerFrame =
|
||||||
|
((maxPacketsPerFrame / 2) * partialReadout) / (maxRows / 2);
|
||||||
|
|
||||||
// Generate data
|
// Generate data
|
||||||
char imageData[DATA_BYTES];
|
char imageData[DATA_BYTES];
|
||||||
memset(imageData, 0, DATA_BYTES);
|
memset(imageData, 0, DATA_BYTES);
|
||||||
|
{
|
||||||
|
const int npixels = (NCHAN * NCHIP);
|
||||||
|
const int pixelsPerPacket = dataSize / NUM_BYTES_PER_PIXEL;
|
||||||
|
int pixelVal = 0;
|
||||||
for (int i = 0; i < npixels; ++i) {
|
for (int i = 0; i < npixels; ++i) {
|
||||||
// avoiding gain also being divided when gappixels enabled in call
|
// avoiding gain also being divided when gappixels enabled in call
|
||||||
// back
|
// back
|
||||||
|
if (i > 0 && i % pixelsPerPacket == 0) {
|
||||||
|
++pixelVal;
|
||||||
|
}
|
||||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||||
virtual_image_test_mode ? 0x0FFE : (uint16_t)i;
|
virtual_image_test_mode ? 0x0FFE : (uint16_t)pixelVal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send data
|
// Send data
|
||||||
@ -2289,7 +2340,6 @@ void *start_timer(void *arg) {
|
|||||||
uint64_t frameNr = 0;
|
uint64_t frameNr = 0;
|
||||||
getNextFrameNumber(&frameNr);
|
getNextFrameNumber(&frameNr);
|
||||||
for (int iframes = 0; iframes != numFrames; ++iframes) {
|
for (int iframes = 0; iframes != numFrames; ++iframes) {
|
||||||
|
|
||||||
usleep(transmissionDelayUs);
|
usleep(transmissionDelayUs);
|
||||||
|
|
||||||
// check if manual stop
|
// check if manual stop
|
||||||
@ -2305,9 +2355,16 @@ void *start_timer(void *arg) {
|
|||||||
|
|
||||||
int srcOffset = 0;
|
int srcOffset = 0;
|
||||||
int srcOffset2 = DATA_BYTES / 2;
|
int srcOffset2 = DATA_BYTES / 2;
|
||||||
// loop packet
|
// loop packet (128 packets)
|
||||||
for (int i = 0; i != packetsPerFrame; ++i) {
|
for (int i = 0; i != maxPacketsPerFrame; ++i) {
|
||||||
// set header
|
|
||||||
|
const int startval =
|
||||||
|
(maxPacketsPerFrame / 2) - (packetsPerFrame / 2);
|
||||||
|
const int endval = startval + packetsPerFrame - 1;
|
||||||
|
int pnum = i;
|
||||||
|
|
||||||
|
// first interface
|
||||||
|
if (numInterfaces == 1 || i < (maxPacketsPerFrame / 2)) {
|
||||||
char packetData[packetsize];
|
char packetData[packetsize];
|
||||||
memset(packetData, 0, packetsize);
|
memset(packetData, 0, packetsize);
|
||||||
sls_detector_header *header =
|
sls_detector_header *header =
|
||||||
@ -2315,37 +2372,47 @@ void *start_timer(void *arg) {
|
|||||||
header->detType = (uint16_t)myDetectorType;
|
header->detType = (uint16_t)myDetectorType;
|
||||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||||
header->frameNumber = frameNr + iframes;
|
header->frameNumber = frameNr + iframes;
|
||||||
header->packetNumber = i;
|
header->packetNumber = pnum;
|
||||||
header->modId = 0;
|
header->modId = 0;
|
||||||
header->row = detPos[2];
|
header->row = detPos[0];
|
||||||
header->column = detPos[3];
|
header->column = detPos[1];
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header),
|
memcpy(packetData + sizeof(sls_detector_header),
|
||||||
imageData + srcOffset, dataSize);
|
imageData + srcOffset, dataSize);
|
||||||
srcOffset += dataSize;
|
srcOffset += dataSize;
|
||||||
|
|
||||||
|
if (i >= startval && i <= endval) {
|
||||||
sendUDPPacket(0, packetData, packetsize);
|
sendUDPPacket(0, packetData, packetsize);
|
||||||
|
LOG(logDEBUG1, ("Sent packet: %d [interface 0]\n", i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// second interface
|
// second interface
|
||||||
|
else if (numInterfaces == 2 && i >= (maxPacketsPerFrame / 2)) {
|
||||||
|
pnum = i % (maxPacketsPerFrame / 2);
|
||||||
|
|
||||||
char packetData2[packetsize];
|
char packetData2[packetsize];
|
||||||
memset(packetData2, 0, packetsize);
|
memset(packetData2, 0, packetsize);
|
||||||
if (numInterfaces == 2) {
|
sls_detector_header *header =
|
||||||
header = (sls_detector_header *)(packetData2);
|
(sls_detector_header *)(packetData2);
|
||||||
header->detType = (uint16_t)myDetectorType;
|
header->detType = (uint16_t)myDetectorType;
|
||||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||||
header->frameNumber = frameNr + iframes;
|
header->frameNumber = frameNr + iframes;
|
||||||
header->packetNumber = i;
|
header->packetNumber = pnum;
|
||||||
header->modId = 0;
|
header->modId = 0;
|
||||||
header->row = detPos[0];
|
header->row = detPos[2];
|
||||||
header->column = detPos[1];
|
header->column = detPos[3];
|
||||||
|
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData2 + sizeof(sls_detector_header),
|
memcpy(packetData2 + sizeof(sls_detector_header),
|
||||||
imageData + srcOffset2, dataSize);
|
imageData + srcOffset2, dataSize);
|
||||||
srcOffset2 += dataSize;
|
srcOffset2 += dataSize;
|
||||||
|
|
||||||
|
if (i >= startval && i <= endval) {
|
||||||
sendUDPPacket(1, packetData2, packetsize);
|
sendUDPPacket(1, packetData2, packetsize);
|
||||||
|
LOG(logDEBUG1, ("Sent packet: %d [interface 1]\n", pnum));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LOG(logINFO, ("Sent frame: %d\n", iframes));
|
LOG(logINFO, ("Sent frame: %d\n", iframes));
|
||||||
|
@ -114,6 +114,9 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
|||||||
#define DAC_MIN_MV (0)
|
#define DAC_MIN_MV (0)
|
||||||
#define DAC_MAX_MV (2500)
|
#define DAC_MAX_MV (2500)
|
||||||
#define MAX_FILTER_CELL_VAL (12)
|
#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
|
||||||
|
|
||||||
/* Defines in the Firmware */
|
/* Defines in the Firmware */
|
||||||
#define MAX_TIMESLOT_VAL (0x1F)
|
#define MAX_TIMESLOT_VAL (0x1F)
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -409,8 +409,8 @@ int setQuad(int value);
|
|||||||
int getQuad();
|
int getQuad();
|
||||||
int setInterruptSubframe(int value);
|
int setInterruptSubframe(int value);
|
||||||
int getInterruptSubframe();
|
int getInterruptSubframe();
|
||||||
int setReadNLines(int value);
|
int setPartialReadout(int value);
|
||||||
int getReadNLines();
|
int getPartialReadout();
|
||||||
#endif
|
#endif
|
||||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(EIGERD) || \
|
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(EIGERD) || \
|
||||||
defined(MYTHEN3D)
|
defined(MYTHEN3D)
|
||||||
@ -449,6 +449,8 @@ void setDigitalIODelay(uint64_t pinMask, int delay);
|
|||||||
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock,
|
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock,
|
||||||
// pll, flashing firmware
|
// pll, flashing firmware
|
||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
|
int setPartialReadout(int value);
|
||||||
|
int getPartialReadout();
|
||||||
void initReadoutConfiguration();
|
void initReadoutConfiguration();
|
||||||
int powerChip(int on);
|
int powerChip(int on);
|
||||||
int isChipConfigured();
|
int isChipConfigured();
|
||||||
|
@ -144,8 +144,8 @@ int set_quad(int);
|
|||||||
int get_quad(int);
|
int get_quad(int);
|
||||||
int set_interrupt_subframe(int);
|
int set_interrupt_subframe(int);
|
||||||
int get_interrupt_subframe(int);
|
int get_interrupt_subframe(int);
|
||||||
int set_read_n_lines(int);
|
int set_partial_readout(int);
|
||||||
int get_read_n_lines(int);
|
int get_partial_readout(int);
|
||||||
void calculate_and_set_position();
|
void calculate_and_set_position();
|
||||||
int set_detector_position(int);
|
int set_detector_position(int);
|
||||||
int check_detector_idle();
|
int check_detector_idle();
|
||||||
|
@ -273,8 +273,8 @@ void function_table() {
|
|||||||
flist[F_GET_QUAD] = &get_quad;
|
flist[F_GET_QUAD] = &get_quad;
|
||||||
flist[F_SET_INTERRUPT_SUBFRAME] = &set_interrupt_subframe;
|
flist[F_SET_INTERRUPT_SUBFRAME] = &set_interrupt_subframe;
|
||||||
flist[F_GET_INTERRUPT_SUBFRAME] = &get_interrupt_subframe;
|
flist[F_GET_INTERRUPT_SUBFRAME] = &get_interrupt_subframe;
|
||||||
flist[F_SET_READ_N_LINES] = &set_read_n_lines;
|
flist[F_SET_PARTIAL_READOUT] = &set_partial_readout;
|
||||||
flist[F_GET_READ_N_LINES] = &get_read_n_lines;
|
flist[F_GET_PARTIAL_READOUT] = &get_partial_readout;
|
||||||
flist[F_SET_POSITION] = &set_detector_position;
|
flist[F_SET_POSITION] = &set_detector_position;
|
||||||
flist[F_SET_SOURCE_UDP_MAC] = &set_source_udp_mac;
|
flist[F_SET_SOURCE_UDP_MAC] = &set_source_udp_mac;
|
||||||
flist[F_GET_SOURCE_UDP_MAC] = &get_source_udp_mac;
|
flist[F_GET_SOURCE_UDP_MAC] = &get_source_udp_mac;
|
||||||
@ -1694,8 +1694,8 @@ int acquire(int blocking, int file_des) {
|
|||||||
// chipv1.1 has to be configured before acquisition
|
// chipv1.1 has to be configured before acquisition
|
||||||
if (getChipVersion() == 11 && !isChipConfigured()) {
|
if (getChipVersion() == 11 && !isChipConfigured()) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess,
|
strcpy(mess, "Could not start acquisition. Chip is not configured. "
|
||||||
"Could not start acquisition. Chip is not configured.\n");
|
"Power it on to configure it.\n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
@ -4717,16 +4717,16 @@ int get_interrupt_subframe(int file_des) {
|
|||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
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;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int arg = 0;
|
int arg = 0;
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
LOG(logINFO, ("Setting read n lines: %u\n", arg));
|
LOG(logDEBUG1, ("Setting partial readout: %u\n", arg));
|
||||||
|
|
||||||
#ifndef EIGERD
|
#if !defined(EIGERD) && !defined(JUNGFRAUD)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
@ -4734,11 +4734,12 @@ int set_read_n_lines(int file_des) {
|
|||||||
if (arg <= 0 || arg > MAX_ROWS_PER_READOUT) {
|
if (arg <= 0 || arg > MAX_ROWS_PER_READOUT) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Could not set number of lines readout. Must be between 1 "
|
"Could not set partial readout. Must be between %d "
|
||||||
"and %d\n",
|
"and %d\n",
|
||||||
MAX_ROWS_PER_READOUT);
|
MIN_ROWS_PER_READOUT, MAX_ROWS_PER_READOUT);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef EIGERD
|
||||||
int dr = setDynamicRange(GET_FLAG);
|
int dr = setDynamicRange(GET_FLAG);
|
||||||
int isTenGiga = enableTenGigabitEthernet(GET_FLAG);
|
int isTenGiga = enableTenGigabitEthernet(GET_FLAG);
|
||||||
unsigned int maxnl = MAX_ROWS_PER_READOUT;
|
unsigned int maxnl = MAX_ROWS_PER_READOUT;
|
||||||
@ -4746,24 +4747,35 @@ int set_read_n_lines(int file_des) {
|
|||||||
if ((arg * maxnp) % maxnl) {
|
if ((arg * maxnp) % maxnl) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
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 "
|
"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",
|
"divisible by %d\n",
|
||||||
arg, dr, isTenGiga ? "enabled" : "disabled", arg, maxnp,
|
arg, dr, isTenGiga ? "enabled" : "disabled", arg, maxnp,
|
||||||
maxnl);
|
maxnl);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else
|
||||||
if (setReadNLines(arg) == FAIL) {
|
#elif JUNGFRAUD
|
||||||
|
if (arg % PARTIAL_READOUT_MULTIPLE != 0) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Could not set read n lines to %d.\n", arg);
|
sprintf(mess,
|
||||||
|
"Could not set partial readout. %d must be a multiple "
|
||||||
|
"of %d\n",
|
||||||
|
arg, PARTIAL_READOUT_MULTIPLE);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (setPartialReadout(arg) == FAIL) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Could not set partial readout to %d.\n", arg);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
int retval = getReadNLines();
|
int retval = getPartialReadout();
|
||||||
if (arg != retval) {
|
if (arg != retval) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess,
|
sprintf(mess,
|
||||||
"Could not set read n lines. Set %d, but "
|
"Could not set partial readout. Set %d, but "
|
||||||
"read %d\n",
|
"read %d\n",
|
||||||
retval, arg);
|
retval, arg);
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
@ -4776,24 +4788,24 @@ int set_read_n_lines(int file_des) {
|
|||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
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;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Getting read n lines\n"));
|
LOG(logDEBUG1, ("Getting partial readout\n"));
|
||||||
|
|
||||||
#ifndef EIGERD
|
#if !defined(EIGERD) && !defined(JUNGFRAUD)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
retval = getReadNLines();
|
retval = getPartialReadout();
|
||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Could not get read n lines. \n");
|
sprintf(mess, "Could not get partial readout. \n");
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
} else {
|
} else {
|
||||||
LOG(logDEBUG1, ("Read N Lines retval: %u\n", retval));
|
LOG(logDEBUG1, ("Partial readout retval: %u\n", retval));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
@ -7126,9 +7138,9 @@ int get_receiver_parameters(int file_des) {
|
|||||||
if (n < 0)
|
if (n < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
|
|
||||||
// readnlines
|
// partialReadout
|
||||||
#ifdef EIGERD
|
#if defined(EIGERD) || defined(JUNGFRAUD)
|
||||||
i32 = getReadNLines();
|
i32 = getPartialReadout();
|
||||||
#else
|
#else
|
||||||
i32 = 0;
|
i32 = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -509,6 +509,15 @@ class Detector {
|
|||||||
/** [CTB] Options: 0-255 \n [Gotthard2] Options: 0-7 */
|
/** [CTB] Options: 0-255 \n [Gotthard2] Options: 0-7 */
|
||||||
void setDBITPipeline(int value, Positions pos = {});
|
void setDBITPipeline(int value, Positions pos = {});
|
||||||
|
|
||||||
|
/** [Eiger][Jungfrau] */
|
||||||
|
Result<int> getPartialReadout(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Eiger] Number of lines 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 = {});
|
||||||
|
|
||||||
///@{
|
///@{
|
||||||
|
|
||||||
/** @name Acquisition */
|
/** @name Acquisition */
|
||||||
@ -1048,15 +1057,6 @@ class Detector {
|
|||||||
*/
|
*/
|
||||||
void setRateCorrection(ns dead_time, Positions pos = {});
|
void setRateCorrection(ns dead_time, Positions pos = {});
|
||||||
|
|
||||||
/** [Eiger] */
|
|
||||||
Result<int> getPartialReadout(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Eiger] Number of lines to read out per half module
|
|
||||||
* Options: 0 - 256. 256 is default. The permissible values depend on
|
|
||||||
* dynamic range and 10Gbe enabled.
|
|
||||||
*/
|
|
||||||
void setPartialReadout(const int lines, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Eiger] */
|
/** [Eiger] */
|
||||||
Result<bool> getInterruptSubframe(Positions pos = {}) const;
|
Result<bool> getInterruptSubframe(Positions pos = {}) const;
|
||||||
|
|
||||||
|
@ -593,6 +593,7 @@ class CmdProxy {
|
|||||||
{"vhighvoltage", "highvoltage"},
|
{"vhighvoltage", "highvoltage"},
|
||||||
{"digitest", "imagetest"},
|
{"digitest", "imagetest"},
|
||||||
{"filter", "filterresistor"},
|
{"filter", "filterresistor"},
|
||||||
|
{"readnlines", "partialread"},
|
||||||
|
|
||||||
/** temperature */
|
/** temperature */
|
||||||
|
|
||||||
@ -806,6 +807,7 @@ class CmdProxy {
|
|||||||
{"filterresistor", &CmdProxy::filterresistor},
|
{"filterresistor", &CmdProxy::filterresistor},
|
||||||
{"currentsource", &CmdProxy::CurrentSource},
|
{"currentsource", &CmdProxy::CurrentSource},
|
||||||
{"dbitpipeline", &CmdProxy::dbitpipeline},
|
{"dbitpipeline", &CmdProxy::dbitpipeline},
|
||||||
|
{"partialread", &CmdProxy::partialread},
|
||||||
|
|
||||||
/** temperature */
|
/** temperature */
|
||||||
{"templist", &CmdProxy::templist},
|
{"templist", &CmdProxy::templist},
|
||||||
@ -914,7 +916,6 @@ class CmdProxy {
|
|||||||
{"subdeadtime", &CmdProxy::subdeadtime},
|
{"subdeadtime", &CmdProxy::subdeadtime},
|
||||||
{"overflow", &CmdProxy::overflow},
|
{"overflow", &CmdProxy::overflow},
|
||||||
{"ratecorr", &CmdProxy::RateCorrection},
|
{"ratecorr", &CmdProxy::RateCorrection},
|
||||||
{"readnlines", &CmdProxy::readnlines},
|
|
||||||
{"interruptsubframe", &CmdProxy::interruptsubframe},
|
{"interruptsubframe", &CmdProxy::interruptsubframe},
|
||||||
{"measuredperiod", &CmdProxy::measuredperiod},
|
{"measuredperiod", &CmdProxy::measuredperiod},
|
||||||
{"measuredsubperiod", &CmdProxy::measuredsubperiod},
|
{"measuredsubperiod", &CmdProxy::measuredsubperiod},
|
||||||
@ -1368,6 +1369,12 @@ class CmdProxy {
|
|||||||
"clock for latching digital bits.\n\t[Gotthard2] "
|
"clock for latching digital bits.\n\t[Gotthard2] "
|
||||||
"Options: 0-7\n\t[CTB] Options: 0-255");
|
"Options: 0-7\n\t[CTB] Options: 0-255");
|
||||||
|
|
||||||
|
INTEGER_COMMAND_VEC_ID(
|
||||||
|
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.\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.");
|
||||||
|
|
||||||
/** temperature */
|
/** temperature */
|
||||||
GET_COMMAND_NOID(
|
GET_COMMAND_NOID(
|
||||||
templist, getTemperatureList,
|
templist, getTemperatureList,
|
||||||
@ -1808,12 +1815,6 @@ class CmdProxy {
|
|||||||
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in "
|
"[0, 1]\n\t[Eiger] Enable or disable show overflow flag in "
|
||||||
"32 bit mode. Default is disabled.");
|
"32 bit mode. Default is disabled.");
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
|
||||||
readnlines, 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.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
interruptsubframe, getInterruptSubframe, setInterruptSubframe,
|
interruptsubframe, getInterruptSubframe, setInterruptSubframe,
|
||||||
StringTo<int>,
|
StringTo<int>,
|
||||||
|
@ -732,6 +732,14 @@ void Detector::setDBITPipeline(int value, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setDBITPipeline, pos, value);
|
pimpl->Parallel(&Module::setDBITPipeline, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result<int> Detector::getPartialReadout(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getPartialReadout, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setPartialReadout(const int lines, Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setPartialReadout, pos, lines);
|
||||||
|
}
|
||||||
|
|
||||||
// Acquisition
|
// Acquisition
|
||||||
|
|
||||||
void Detector::acquire() { pimpl->acquire(); }
|
void Detector::acquire() { pimpl->acquire(); }
|
||||||
@ -839,13 +847,14 @@ void Detector::setNumberofUDPInterfaces_(int n, Positions pos) {
|
|||||||
bool previouslyClientStreaming = pimpl->getDataStreamingToClient();
|
bool previouslyClientStreaming = pimpl->getDataStreamingToClient();
|
||||||
bool useReceiver = getUseReceiverFlag().squash(false);
|
bool useReceiver = getUseReceiverFlag().squash(false);
|
||||||
bool previouslyReceiverStreaming = false;
|
bool previouslyReceiverStreaming = false;
|
||||||
|
int startingPort = 0;
|
||||||
if (useReceiver) {
|
if (useReceiver) {
|
||||||
previouslyReceiverStreaming = getRxZmqDataStream(pos).squash(true);
|
previouslyReceiverStreaming = getRxZmqDataStream(pos).squash(true);
|
||||||
|
startingPort = getRxZmqPort({0}).squash(0);
|
||||||
}
|
}
|
||||||
pimpl->Parallel(&Module::setNumberofUDPInterfaces, pos, n);
|
pimpl->Parallel(&Module::setNumberofUDPInterfaces, pos, n);
|
||||||
// ensure receiver zmq socket ports are multiplied by 2 (2 interfaces)
|
// ensure receiver zmq socket ports are multiplied by 2 (2 interfaces)
|
||||||
if (getUseReceiverFlag().squash(false) && size()) {
|
if (getUseReceiverFlag().squash(false) && size()) {
|
||||||
int startingPort = getRxZmqPort({0}).squash(0);
|
|
||||||
setRxZmqPort(startingPort, -1);
|
setRxZmqPort(startingPort, -1);
|
||||||
}
|
}
|
||||||
// redo the zmq sockets if enabled
|
// redo the zmq sockets if enabled
|
||||||
@ -1372,14 +1381,6 @@ void Detector::updateRxRateCorrections() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getPartialReadout(Positions pos) const {
|
|
||||||
return pimpl->Parallel(&Module::getReadNLines, pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setPartialReadout(const int lines, Positions pos) {
|
|
||||||
pimpl->Parallel(&Module::setReadNLines, pos, lines);
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<bool> Detector::getInterruptSubframe(Positions pos) const {
|
Result<bool> Detector::getInterruptSubframe(Positions pos) const {
|
||||||
return pimpl->Parallel(&Module::getInterruptSubframe, pos);
|
return pimpl->Parallel(&Module::getInterruptSubframe, pos);
|
||||||
}
|
}
|
||||||
|
@ -734,6 +734,17 @@ void Module::setDBITPipeline(int value) {
|
|||||||
sendToDetector(F_SET_DBIT_PIPELINE, value, nullptr);
|
sendToDetector(F_SET_DBIT_PIPELINE, value, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Module::getPartialReadout() const {
|
||||||
|
return sendToDetector<int>(F_GET_PARTIAL_READOUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::setPartialReadout(const int value) {
|
||||||
|
sendToDetector(F_SET_PARTIAL_READOUT, value, nullptr);
|
||||||
|
if (shm()->useReceiverFlag) {
|
||||||
|
sendToReceiver(F_SET_RECEIVER_PARTIAL_READOUT, value, nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Acquisition
|
// Acquisition
|
||||||
|
|
||||||
void Module::startReceiver() {
|
void Module::startReceiver() {
|
||||||
@ -1469,17 +1480,6 @@ void Module::sendReceiverRateCorrections(const std::vector<int64_t> &t) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Module::getReadNLines() const {
|
|
||||||
return sendToDetector<int>(F_GET_READ_N_LINES);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module::setReadNLines(const int value) {
|
|
||||||
sendToDetector(F_SET_READ_N_LINES, value, nullptr);
|
|
||||||
if (shm()->useReceiverFlag) {
|
|
||||||
sendToReceiver(F_SET_RECEIVER_READ_N_LINES, value, nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Module::getInterruptSubframe() const {
|
bool Module::getInterruptSubframe() const {
|
||||||
return sendToDetector<int>(F_GET_INTERRUPT_SUBFRAME);
|
return sendToDetector<int>(F_GET_INTERRUPT_SUBFRAME);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,8 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setCurrentSource(defs::currentSrcParameters par);
|
void setCurrentSource(defs::currentSrcParameters par);
|
||||||
int getDBITPipeline() const;
|
int getDBITPipeline() const;
|
||||||
void setDBITPipeline(int value);
|
void setDBITPipeline(int value);
|
||||||
|
int getPartialReadout() const;
|
||||||
|
void setPartialReadout(const int value);
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* Acquisition *
|
* Acquisition *
|
||||||
@ -337,8 +338,6 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setDefaultRateCorrection();
|
void setDefaultRateCorrection();
|
||||||
void setRateCorrection(int64_t t = 0);
|
void setRateCorrection(int64_t t = 0);
|
||||||
void sendReceiverRateCorrections(const std::vector<int64_t> &t);
|
void sendReceiverRateCorrections(const std::vector<int64_t> &t);
|
||||||
int getReadNLines() const;
|
|
||||||
void setReadNLines(const int value);
|
|
||||||
bool getInterruptSubframe() const;
|
bool getInterruptSubframe() const;
|
||||||
void setInterruptSubframe(const bool enable);
|
void setInterruptSubframe(const bool enable);
|
||||||
int64_t getMeasuredPeriod() const;
|
int64_t getMeasuredPeriod() const;
|
||||||
|
@ -374,36 +374,6 @@ TEST_CASE("ratecorr", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("readnlines", "[.cmd]") {
|
|
||||||
Detector det;
|
|
||||||
CmdProxy proxy(&det);
|
|
||||||
auto det_type = det.getDetectorType().squash();
|
|
||||||
if (det_type == defs::EIGER) {
|
|
||||||
auto prev_val = det.getPartialReadout();
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("readnlines", {"256"}, -1, PUT, oss);
|
|
||||||
REQUIRE(oss.str() == "readnlines 256\n");
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("readnlines", {}, -1, GET, oss);
|
|
||||||
REQUIRE(oss.str() == "readnlines 256\n");
|
|
||||||
}
|
|
||||||
{
|
|
||||||
std::ostringstream oss;
|
|
||||||
proxy.Call("readnlines", {"16"}, -1, PUT, oss);
|
|
||||||
REQUIRE(oss.str() == "readnlines 16\n");
|
|
||||||
}
|
|
||||||
REQUIRE_THROWS(proxy.Call("readnlines", {"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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("interruptsubframe", "[.cmd]") {
|
TEST_CASE("interruptsubframe", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
@ -1494,6 +1494,43 @@ TEST_CASE("dbitpipeline", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("partialread", "[.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();
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("partialread", {"256"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "partialread 256\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("partialread", {}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "partialread 256\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("partialread", {"16"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "partialread 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("partialread", {"0"}, -1, PUT));
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setPartialReadout(prev_val[i], {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("partialread", {}, -1, GET));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("currentsource", "[.cmd]") {
|
TEST_CASE("currentsource", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
@ -187,7 +187,7 @@ int ClientInterface::functionTable(){
|
|||||||
flist[F_SET_RECEIVER_DBIT_OFFSET] = &ClientInterface::set_dbit_offset;
|
flist[F_SET_RECEIVER_DBIT_OFFSET] = &ClientInterface::set_dbit_offset;
|
||||||
flist[F_GET_RECEIVER_DBIT_OFFSET] = &ClientInterface::get_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_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_IP] = &ClientInterface::set_udp_ip;
|
||||||
flist[F_SET_RECEIVER_UDP_IP2] = &ClientInterface::set_udp_ip2;
|
flist[F_SET_RECEIVER_UDP_IP2] = &ClientInterface::set_udp_ip2;
|
||||||
flist[F_SET_RECEIVER_UDP_PORT] = &ClientInterface::set_udp_port;
|
flist[F_SET_RECEIVER_UDP_PORT] = &ClientInterface::set_udp_port;
|
||||||
@ -224,6 +224,7 @@ int ClientInterface::functionTable(){
|
|||||||
int ClientInterface::decodeFunction(Interface &socket) {
|
int ClientInterface::decodeFunction(Interface &socket) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
socket.Receive(fnum);
|
socket.Receive(fnum);
|
||||||
|
socket.setFnum(fnum);
|
||||||
if (fnum <= NUM_DET_FUNCTIONS || fnum >= NUM_REC_FUNCTIONS) {
|
if (fnum <= NUM_DET_FUNCTIONS || fnum >= NUM_REC_FUNCTIONS) {
|
||||||
throw RuntimeError("Unrecognized Function enum " +
|
throw RuntimeError("Unrecognized Function enum " +
|
||||||
std::to_string(fnum) + "\n");
|
std::to_string(fnum) + "\n");
|
||||||
@ -413,9 +414,11 @@ int ClientInterface::setup_receiver(Interface &socket) {
|
|||||||
std::to_string(arg.quad) +
|
std::to_string(arg.quad) +
|
||||||
" due to fifo strucutre memory allocation");
|
" due to fifo strucutre memory allocation");
|
||||||
}
|
}
|
||||||
impl()->setReadNLines(arg.numLinesReadout);
|
|
||||||
impl()->setThresholdEnergy(arg.thresholdEnergyeV[0]);
|
impl()->setThresholdEnergy(arg.thresholdEnergyeV[0]);
|
||||||
}
|
}
|
||||||
|
if (myDetectorType == EIGER || myDetectorType == JUNGFRAU) {
|
||||||
|
impl()->setPartialReadout(arg.partialReadout);
|
||||||
|
}
|
||||||
if (myDetectorType == MYTHEN3) {
|
if (myDetectorType == MYTHEN3) {
|
||||||
std::array<int, 3> val;
|
std::array<int, 3> val;
|
||||||
for (int i = 0; i < 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
@ -1403,16 +1406,19 @@ int ClientInterface::set_quad_type(Interface &socket) {
|
|||||||
return socket.Send(OK);
|
return socket.Send(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ClientInterface::set_read_n_lines(Interface &socket) {
|
int ClientInterface::set_partial_readout(Interface &socket) {
|
||||||
auto arg = socket.Receive<int>();
|
auto arg = socket.Receive<int>();
|
||||||
if (arg >= 0) {
|
if (arg >= 0) {
|
||||||
verifyIdle(socket);
|
verifyIdle(socket);
|
||||||
LOG(logDEBUG1) << "Setting Read N Lines:" << arg;
|
if (myDetectorType != EIGER && myDetectorType != JUNGFRAU) {
|
||||||
impl()->setReadNLines(arg);
|
throw RuntimeError("Could not set partial readout. Not implemented for this detector");
|
||||||
}
|
}
|
||||||
int retval = impl()->getReadNLines();
|
LOG(logDEBUG1) << "Setting Partial Readout:" << arg;
|
||||||
validate(arg, retval, "set read n lines", DEC);
|
impl()->setPartialReadout(arg);
|
||||||
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);
|
return socket.Send(OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ class ClientInterface : private virtual slsDetectorDefs {
|
|||||||
int set_dbit_offset(sls::ServerInterface &socket);
|
int set_dbit_offset(sls::ServerInterface &socket);
|
||||||
int get_dbit_offset(sls::ServerInterface &socket);
|
int get_dbit_offset(sls::ServerInterface &socket);
|
||||||
int set_quad_type(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);
|
sls::MacAddr setUdpIp(sls::IpAddr arg);
|
||||||
int set_udp_ip(sls::ServerInterface &socket);
|
int set_udp_ip(sls::ServerInterface &socket);
|
||||||
sls::MacAddr setUdpIp2(sls::IpAddr arg);
|
sls::MacAddr setUdpIp2(sls::IpAddr arg);
|
||||||
|
@ -51,6 +51,7 @@ class GeneralData {
|
|||||||
uint32_t vetoPacketSize{0};
|
uint32_t vetoPacketSize{0};
|
||||||
uint32_t vetoImageSize{0};
|
uint32_t vetoImageSize{0};
|
||||||
uint32_t vetoHsize{0};
|
uint32_t vetoHsize{0};
|
||||||
|
uint32_t maxRowsPerReadout{0};
|
||||||
|
|
||||||
GeneralData(){};
|
GeneralData(){};
|
||||||
virtual ~GeneralData(){};
|
virtual ~GeneralData(){};
|
||||||
@ -339,6 +340,7 @@ class EigerData : public GeneralData {
|
|||||||
threadsPerReceiver = 2;
|
threadsPerReceiver = 2;
|
||||||
headerPacketSize = 40;
|
headerPacketSize = 40;
|
||||||
standardheader = true;
|
standardheader = true;
|
||||||
|
maxRowsPerReadout = 256;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -384,6 +386,7 @@ class JungfrauData : public GeneralData {
|
|||||||
defaultFifoDepth = 2500;
|
defaultFifoDepth = 2500;
|
||||||
standardheader = true;
|
standardheader = true;
|
||||||
defaultUdpSocketBufferSize = (1000 * 1024 * 1024);
|
defaultUdpSocketBufferSize = (1000 * 1024 * 1024);
|
||||||
|
maxRowsPerReadout = 512;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -477,8 +477,8 @@ std::vector<uint64_t> Implementation::getNumMissingPackets() const {
|
|||||||
int np = generalData->packetsPerFrame;
|
int np = generalData->packetsPerFrame;
|
||||||
uint64_t totnp = np;
|
uint64_t totnp = np;
|
||||||
// partial readout
|
// partial readout
|
||||||
if (numLinesReadout != MAX_EIGER_ROWS_PER_READOUT) {
|
if (partialReadout != generalData->maxRowsPerReadout) {
|
||||||
totnp = ((numLinesReadout * np) / MAX_EIGER_ROWS_PER_READOUT);
|
totnp = ((partialReadout * np) / generalData->maxRowsPerReadout);
|
||||||
}
|
}
|
||||||
totnp *= numberOfTotalFrames;
|
totnp *= numberOfTotalFrames;
|
||||||
mp[i] = listener[i]->GetNumMissingPacket(stoppedFlag, totnp);
|
mp[i] = listener[i]->GetNumMissingPacket(stoppedFlag, totnp);
|
||||||
@ -765,7 +765,7 @@ void Implementation::SetupWriter() {
|
|||||||
masterAttributes->subExptime = subExpTime;
|
masterAttributes->subExptime = subExpTime;
|
||||||
masterAttributes->subPeriod = subPeriod;
|
masterAttributes->subPeriod = subPeriod;
|
||||||
masterAttributes->quad = quadEnable;
|
masterAttributes->quad = quadEnable;
|
||||||
masterAttributes->numLinesReadout = numLinesReadout;
|
masterAttributes->partialReadout = partialReadout;
|
||||||
masterAttributes->ratecorr = rateCorrections;
|
masterAttributes->ratecorr = rateCorrections;
|
||||||
masterAttributes->adcmask =
|
masterAttributes->adcmask =
|
||||||
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga;
|
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga;
|
||||||
@ -1533,11 +1533,11 @@ void Implementation::setDeactivatedPadding(bool enable) {
|
|||||||
<< (deactivatedPaddingEnable ? "enabled" : "disabled");
|
<< (deactivatedPaddingEnable ? "enabled" : "disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
int Implementation::getReadNLines() const { return numLinesReadout; }
|
int Implementation::getPartialReadout() const { return partialReadout; }
|
||||||
|
|
||||||
void Implementation::setReadNLines(const int value) {
|
void Implementation::setPartialReadout(const int value) {
|
||||||
numLinesReadout = value;
|
partialReadout = value;
|
||||||
LOG(logINFO) << "Number of Lines to readout: " << numLinesReadout;
|
LOG(logINFO) << "Partial readout (#rows): " << partialReadout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Implementation::setThresholdEnergy(const int value) {
|
void Implementation::setThresholdEnergy(const int value) {
|
||||||
|
@ -218,9 +218,9 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
bool getDeactivatedPadding() const;
|
bool getDeactivatedPadding() const;
|
||||||
/* [Eiger] */
|
/* [Eiger] */
|
||||||
void setDeactivatedPadding(const bool enable);
|
void setDeactivatedPadding(const bool enable);
|
||||||
int getReadNLines() const;
|
int getPartialReadout() const;
|
||||||
/* [Eiger] */
|
/* [Eiger][Jungfrau] */
|
||||||
void setReadNLines(const int value);
|
void setPartialReadout(const int value);
|
||||||
/** [Eiger] */
|
/** [Eiger] */
|
||||||
void setThresholdEnergy(const int value);
|
void setThresholdEnergy(const int value);
|
||||||
void setThresholdEnergy(const std::array<int, 3> value);
|
void setThresholdEnergy(const std::array<int, 3> value);
|
||||||
@ -352,7 +352,7 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
bool activated{true};
|
bool activated{true};
|
||||||
std::array<bool, 2> detectorDataStream = {{true, true}};
|
std::array<bool, 2> detectorDataStream = {{true, true}};
|
||||||
bool deactivatedPaddingEnable{true};
|
bool deactivatedPaddingEnable{true};
|
||||||
int numLinesReadout{MAX_EIGER_ROWS_PER_READOUT};
|
int partialReadout{0};
|
||||||
int thresholdEnergyeV{-1};
|
int thresholdEnergyeV{-1};
|
||||||
std::array<int, 3> thresholdAllEnergyeV = {{-1, -1, -1}};
|
std::array<int, 3> thresholdAllEnergyeV = {{-1, -1, -1}};
|
||||||
std::vector<int64_t> rateCorrections;
|
std::vector<int64_t> rateCorrections;
|
||||||
|
@ -491,7 +491,7 @@ uint32_t Listener::ListenToAnImage(char *buf) {
|
|||||||
|
|
||||||
lastCaughtFrameIndex = fnum;
|
lastCaughtFrameIndex = fnum;
|
||||||
|
|
||||||
LOG(logDEBUG5) << "Listening " << index
|
LOG(logDEBUG1) << "Listening " << index
|
||||||
<< ": currentfindex:" << currentFrameIndex
|
<< ": currentfindex:" << currentFrameIndex
|
||||||
<< ", fnum:" << fnum << ", pnum:" << pnum
|
<< ", fnum:" << fnum << ", pnum:" << pnum
|
||||||
<< ", numpackets:" << numpackets;
|
<< ", numpackets:" << numpackets;
|
||||||
|
@ -37,7 +37,7 @@ struct MasterAttributes {
|
|||||||
ns subExptime{0};
|
ns subExptime{0};
|
||||||
ns subPeriod{0};
|
ns subPeriod{0};
|
||||||
uint32_t quad{0};
|
uint32_t quad{0};
|
||||||
uint32_t numLinesReadout;
|
uint32_t partialReadout;
|
||||||
std::vector<int64_t> ratecorr;
|
std::vector<int64_t> ratecorr;
|
||||||
uint32_t adcmask{0};
|
uint32_t adcmask{0};
|
||||||
uint32_t analog{0};
|
uint32_t analog{0};
|
||||||
@ -336,7 +336,8 @@ class JungfrauMasterAttributes : public MasterAttributes {
|
|||||||
oss << MasterAttributes::GetBinaryMasterAttributes()
|
oss << MasterAttributes::GetBinaryMasterAttributes()
|
||||||
<< "Exptime : " << sls::ToString(exptime) << '\n'
|
<< "Exptime : " << sls::ToString(exptime) << '\n'
|
||||||
<< "Period : " << sls::ToString(period) << '\n'
|
<< "Period : " << sls::ToString(period) << '\n'
|
||||||
<< "Number of UDP Interfaces : " << numUDPInterfaces << '\n';
|
<< "Number of UDP Interfaces : " << numUDPInterfaces << '\n'
|
||||||
|
<< "Partial Readout (rows) : " << partialReadout << '\n';
|
||||||
std::string message = oss.str();
|
std::string message = oss.str();
|
||||||
MasterAttributes::WriteBinaryAttributes(fd, message);
|
MasterAttributes::WriteBinaryAttributes(fd, message);
|
||||||
};
|
};
|
||||||
@ -352,6 +353,13 @@ class JungfrauMasterAttributes : public MasterAttributes {
|
|||||||
"Number of UDP Interfaces", PredType::NATIVE_INT, dataspace);
|
"Number of UDP Interfaces", PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&numUDPInterfaces, PredType::NATIVE_INT);
|
dataset.write(&numUDPInterfaces, PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
|
// partialReadout
|
||||||
|
{
|
||||||
|
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||||
|
DataSet dataset = group->createDataSet(
|
||||||
|
"Partial readout (rows)", PredType::NATIVE_INT, dataspace);
|
||||||
|
dataset.write(&partialReadout, PredType::NATIVE_INT);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
@ -373,7 +381,7 @@ class EigerMasterAttributes : public MasterAttributes {
|
|||||||
<< "SubPeriod : " << sls::ToString(subPeriod)
|
<< "SubPeriod : " << sls::ToString(subPeriod)
|
||||||
<< '\n'
|
<< '\n'
|
||||||
<< "Quad : " << quad << '\n'
|
<< "Quad : " << quad << '\n'
|
||||||
<< "Number of Lines read out : " << numLinesReadout << '\n'
|
<< "Partial Readout (rows) : " << partialReadout << '\n'
|
||||||
<< "Rate Corrections : " << sls::ToString(ratecorr)
|
<< "Rate Corrections : " << sls::ToString(ratecorr)
|
||||||
<< '\n';
|
<< '\n';
|
||||||
std::string message = oss.str();
|
std::string message = oss.str();
|
||||||
@ -427,12 +435,12 @@ class EigerMasterAttributes : public MasterAttributes {
|
|||||||
group->createDataSet("Quad", PredType::NATIVE_INT, dataspace);
|
group->createDataSet("Quad", PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&quad, PredType::NATIVE_INT);
|
dataset.write(&quad, PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// numLinesReadout
|
// partialReadout
|
||||||
{
|
{
|
||||||
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
DataSpace dataspace = DataSpace(H5S_SCALAR);
|
||||||
DataSet dataset = group->createDataSet(
|
DataSet dataset = group->createDataSet(
|
||||||
"Number of Lines read out", PredType::NATIVE_INT, dataspace);
|
"Partial readout (rows)", PredType::NATIVE_INT, dataspace);
|
||||||
dataset.write(&numLinesReadout, PredType::NATIVE_INT);
|
dataset.write(&partialReadout, PredType::NATIVE_INT);
|
||||||
}
|
}
|
||||||
// Rate corrections
|
// Rate corrections
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
|
|
||||||
// parameters to calculate fifo depth
|
// parameters to calculate fifo depth
|
||||||
#define SAMPLE_TIME_IN_NS (100000000) // 100ms
|
#define SAMPLE_TIME_IN_NS (100000000) // 100ms
|
||||||
#define MAX_EIGER_ROWS_PER_READOUT (256)
|
|
||||||
|
|
||||||
// to differentiate between gotthard and short gotthard
|
// to differentiate between gotthard and short gotthard
|
||||||
#define GOTTHARD_PACKET_SIZE (1286)
|
#define GOTTHARD_PACKET_SIZE (1286)
|
||||||
|
@ -25,6 +25,8 @@ class DataSocket {
|
|||||||
DataSocket(const DataSocket &) = delete;
|
DataSocket(const DataSocket &) = delete;
|
||||||
DataSocket &operator=(DataSocket const &) = delete;
|
DataSocket &operator=(DataSocket const &) = delete;
|
||||||
int getSocketId() const { return sockfd_; }
|
int getSocketId() const { return sockfd_; }
|
||||||
|
int getFnum() const { return fnum_; }
|
||||||
|
void setFnum(const int fnum);
|
||||||
|
|
||||||
int Send(const void *buffer, size_t size);
|
int Send(const void *buffer, size_t size);
|
||||||
|
|
||||||
@ -82,6 +84,7 @@ class DataSocket {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int sockfd_ = -1;
|
int sockfd_ = -1;
|
||||||
|
int fnum_ {0};
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace sls
|
}; // namespace sls
|
||||||
|
@ -518,7 +518,7 @@ typedef struct {
|
|||||||
int dataStreamLeft{0};
|
int dataStreamLeft{0};
|
||||||
int dataStreamRight{0};
|
int dataStreamRight{0};
|
||||||
int quad{0};
|
int quad{0};
|
||||||
int numLinesReadout{0};
|
int partialReadout{0};
|
||||||
int thresholdEnergyeV[3]{0, 0, 0};
|
int thresholdEnergyeV[3]{0, 0, 0};
|
||||||
int dynamicRange{16};
|
int dynamicRange{16};
|
||||||
timingMode timMode{AUTO_TIMING};
|
timingMode timMode{AUTO_TIMING};
|
||||||
|
@ -124,8 +124,8 @@ enum detFuncs {
|
|||||||
F_GET_QUAD,
|
F_GET_QUAD,
|
||||||
F_SET_INTERRUPT_SUBFRAME,
|
F_SET_INTERRUPT_SUBFRAME,
|
||||||
F_GET_INTERRUPT_SUBFRAME,
|
F_GET_INTERRUPT_SUBFRAME,
|
||||||
F_SET_READ_N_LINES,
|
F_SET_PARTIAL_READOUT,
|
||||||
F_GET_READ_N_LINES,
|
F_GET_PARTIAL_READOUT,
|
||||||
F_SET_POSITION,
|
F_SET_POSITION,
|
||||||
F_SET_SOURCE_UDP_MAC,
|
F_SET_SOURCE_UDP_MAC,
|
||||||
F_GET_SOURCE_UDP_MAC,
|
F_GET_SOURCE_UDP_MAC,
|
||||||
@ -326,7 +326,7 @@ enum detFuncs {
|
|||||||
F_SET_RECEIVER_DBIT_OFFSET,
|
F_SET_RECEIVER_DBIT_OFFSET,
|
||||||
F_GET_RECEIVER_DBIT_OFFSET,
|
F_GET_RECEIVER_DBIT_OFFSET,
|
||||||
F_SET_RECEIVER_QUAD,
|
F_SET_RECEIVER_QUAD,
|
||||||
F_SET_RECEIVER_READ_N_LINES,
|
F_SET_RECEIVER_PARTIAL_READOUT,
|
||||||
F_SET_RECEIVER_UDP_IP,
|
F_SET_RECEIVER_UDP_IP,
|
||||||
F_SET_RECEIVER_UDP_IP2,
|
F_SET_RECEIVER_UDP_IP2,
|
||||||
F_SET_RECEIVER_UDP_PORT,
|
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_GET_QUAD: return "F_GET_QUAD";
|
||||||
case F_SET_INTERRUPT_SUBFRAME: return "F_SET_INTERRUPT_SUBFRAME";
|
case F_SET_INTERRUPT_SUBFRAME: return "F_SET_INTERRUPT_SUBFRAME";
|
||||||
case F_GET_INTERRUPT_SUBFRAME: return "F_GET_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_SET_PARTIAL_READOUT: return "F_SET_PARTIAL_READOUT";
|
||||||
case F_GET_READ_N_LINES: return "F_GET_READ_N_LINES";
|
case F_GET_PARTIAL_READOUT: return "F_GET_PARTIAL_READOUT";
|
||||||
case F_SET_POSITION: return "F_SET_POSITION";
|
case F_SET_POSITION: return "F_SET_POSITION";
|
||||||
case F_SET_SOURCE_UDP_MAC: return "F_SET_SOURCE_UDP_MAC";
|
case F_SET_SOURCE_UDP_MAC: return "F_SET_SOURCE_UDP_MAC";
|
||||||
case F_GET_SOURCE_UDP_MAC: return "F_GET_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_SET_RECEIVER_DBIT_OFFSET: return "F_SET_RECEIVER_DBIT_OFFSET";
|
||||||
case F_GET_RECEIVER_DBIT_OFFSET: return "F_GET_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_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_IP: return "F_SET_RECEIVER_UDP_IP";
|
||||||
case F_SET_RECEIVER_UDP_IP2: return "F_SET_RECEIVER_UDP_IP2";
|
case F_SET_RECEIVER_UDP_IP2: return "F_SET_RECEIVER_UDP_IP2";
|
||||||
case F_SET_RECEIVER_UDP_PORT: return "F_SET_RECEIVER_UDP_PORT";
|
case F_SET_RECEIVER_UDP_PORT: return "F_SET_RECEIVER_UDP_PORT";
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
/** API versions */
|
/** API versions */
|
||||||
#define GITBRANCH "developer"
|
#define GITBRANCH "j10partial"
|
||||||
#define APILIB 0x210225
|
|
||||||
#define APIRECEIVER 0x210225
|
|
||||||
#define APIGUI 0x210225
|
|
||||||
|
|
||||||
#define APICTB 0x210812
|
#define APILIB 0x210816
|
||||||
#define APIGOTTHARD 0x210812
|
#define APIRECEIVER 0x210816
|
||||||
#define APIJUNGFRAU 0x210812
|
#define APIGUI 0x210816
|
||||||
#define APIMYTHEN3 0x210812
|
#define APICTB 0x210816
|
||||||
#define APIMOENCH 0x210812
|
#define APIGOTTHARD 0x210816
|
||||||
#define APIEIGER 0x210812
|
|
||||||
#define APIGOTTHARD2 0x210816
|
#define APIGOTTHARD2 0x210816
|
||||||
|
#define APIJUNGFRAU 0x210816
|
||||||
|
#define APIMYTHEN3 0x210816
|
||||||
|
#define APIMOENCH 0x210816
|
||||||
|
#define APIEIGER 0x210816
|
||||||
|
@ -63,6 +63,7 @@ int ClientSocket::sendCommandThenRead(int fnum, const void *args,
|
|||||||
size_t retval_size) {
|
size_t retval_size) {
|
||||||
int ret = slsDetectorDefs::FAIL;
|
int ret = slsDetectorDefs::FAIL;
|
||||||
Send(&fnum, sizeof(fnum));
|
Send(&fnum, sizeof(fnum));
|
||||||
|
setFnum(fnum);
|
||||||
Send(args, args_size);
|
Send(args, args_size);
|
||||||
readReply(ret, retval, retval_size);
|
readReply(ret, retval, retval_size);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "sls/DataSocket.h"
|
#include "sls/DataSocket.h"
|
||||||
#include "sls/logger.h"
|
#include "sls/logger.h"
|
||||||
|
#include "sls/sls_detector_funcs.h"
|
||||||
#include "sls/sls_detector_exceptions.h"
|
#include "sls/sls_detector_exceptions.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
@ -41,6 +42,10 @@ DataSocket &DataSocket::operator=(DataSocket &&move) noexcept {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataSocket::setFnum(const int fnum) {
|
||||||
|
fnum_ = fnum;
|
||||||
|
}
|
||||||
|
|
||||||
int DataSocket::Receive(void *buffer, size_t size) {
|
int DataSocket::Receive(void *buffer, size_t size) {
|
||||||
// TODO!(Erik) Add sleep? how many reties?
|
// TODO!(Erik) Add sleep? how many reties?
|
||||||
int bytes_expected = static_cast<int>(size); // signed size
|
int bytes_expected = static_cast<int>(size); // signed size
|
||||||
@ -58,7 +63,7 @@ int DataSocket::Receive(void *buffer, size_t size) {
|
|||||||
} else {
|
} else {
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "TCP socket read " << bytes_read << " bytes instead of "
|
ss << "TCP socket read " << bytes_read << " bytes instead of "
|
||||||
<< bytes_expected << " bytes";
|
<< bytes_expected << " bytes (" << getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
|
||||||
throw sls::SocketError(ss.str());
|
throw sls::SocketError(ss.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +88,7 @@ int DataSocket::Send(const void *buffer, size_t size) {
|
|||||||
if (bytes_sent != data_size) {
|
if (bytes_sent != data_size) {
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << "TCP socket sent " << bytes_sent << " bytes instead of "
|
ss << "TCP socket sent " << bytes_sent << " bytes instead of "
|
||||||
<< data_size << " bytes";
|
<< data_size << " bytes (" << getFunctionNameFromEnum(static_cast<detFuncs>(fnum_)) << ')';
|
||||||
throw sls::SocketError(ss.str());
|
throw sls::SocketError(ss.str());
|
||||||
}
|
}
|
||||||
return bytes_sent;
|
return bytes_sent;
|
||||||
|
@ -55,7 +55,7 @@ std::string ToString(const slsDetectorDefs::rxParameters &r) {
|
|||||||
<< "leftDataStream:" << r.dataStreamLeft << std::endl
|
<< "leftDataStream:" << r.dataStreamLeft << std::endl
|
||||||
<< "rightDataStream:" << r.dataStreamRight << std::endl
|
<< "rightDataStream:" << r.dataStreamRight << std::endl
|
||||||
<< "quad:" << r.quad << std::endl
|
<< "quad:" << r.quad << std::endl
|
||||||
<< "numLinesReadout:" << r.numLinesReadout << std::endl
|
<< "partialReadout:" << r.partialReadout << std::endl
|
||||||
<< "thresholdEnergyeV:" << ToString(r.thresholdEnergyeV) << std::endl
|
<< "thresholdEnergyeV:" << ToString(r.thresholdEnergyeV) << std::endl
|
||||||
<< "dynamicRange:" << r.dynamicRange << std::endl
|
<< "dynamicRange:" << r.dynamicRange << std::endl
|
||||||
<< "timMode:" << r.timMode << std::endl
|
<< "timMode:" << r.timMode << std::endl
|
||||||
|
@ -26,7 +26,7 @@ ZmqSocket::ZmqSocket(const char *const hostname_or_ip,
|
|||||||
if (sockfd.contextDescriptor == nullptr)
|
if (sockfd.contextDescriptor == nullptr)
|
||||||
throw sls::ZmqSocketError("Could not create contextDescriptor");
|
throw sls::ZmqSocketError("Could not create contextDescriptor");
|
||||||
|
|
||||||
// create publisher
|
// create subscriber
|
||||||
sockfd.socketDescriptor = zmq_socket(sockfd.contextDescriptor, ZMQ_SUB);
|
sockfd.socketDescriptor = zmq_socket(sockfd.contextDescriptor, ZMQ_SUB);
|
||||||
if (sockfd.socketDescriptor == nullptr) {
|
if (sockfd.socketDescriptor == nullptr) {
|
||||||
PrintError();
|
PrintError();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user