mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 23:28:04 +01:00
eiger server: quad, interrupt subframe, reg left and right (#45)
* eiger server: quad, interrupt subframe, reg left and right * eiger server: beb can fail in setting up quad, quad and gap pixels
This commit is contained in:
committed by
Erik Fröjdh
parent
e17de0609c
commit
d72b6c3659
@@ -27,7 +27,7 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo* f,
|
||||
fileFormat* ftype, bool fwenable, bool* mfwenable,
|
||||
bool* dsEnable, bool* gpEnable, uint32_t* dr,
|
||||
uint32_t* freq, uint32_t* timer,
|
||||
bool* fp, bool* act, bool* depaden, bool* sm,
|
||||
bool* fp, bool* act, bool* depaden, bool* sm, bool* qe,
|
||||
std::vector <int> * cdl, int* cdo, int* cad) :
|
||||
|
||||
ThreadObject(ind),
|
||||
@@ -49,6 +49,7 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo* f,
|
||||
activated(act),
|
||||
deactivatedPaddingEnable(depaden),
|
||||
silentMode(sm),
|
||||
quadEnable(qe),
|
||||
framePadding(fp),
|
||||
ctbDbitList(cdl),
|
||||
ctbDbitOffset(cdo),
|
||||
@@ -558,29 +559,31 @@ void DataProcessor::InsertGapPixels(char* buf, uint32_t dr) {
|
||||
|
||||
memset(tempBuffer, 0xFF, generalData->imageSize);
|
||||
|
||||
int rightChip = ((*quadEnable) ? 0 : index); // quad enable, then faking both to be left chips
|
||||
const uint32_t nx = generalData->nPixelsX;
|
||||
const uint32_t ny = generalData->nPixelsY;
|
||||
const uint32_t npx = nx * ny;
|
||||
|
||||
bool group3 = (*quadEnable) ? false : true; // if quad enabled, no last line for left chips
|
||||
char* srcptr = nullptr;
|
||||
char* dstptr = nullptr;
|
||||
|
||||
const uint32_t b1px = generalData->imageSize / (npx); // not double as not dealing with 4 bit mode
|
||||
const uint32_t b2px = 2 * b1px;
|
||||
const uint32_t b1pxofst = (index != 0 ? b1px : 0); // left fpga (index 0) has no extra 1px offset, but right fpga has
|
||||
const uint32_t b1pxofst = (rightChip == 0 ? 0 : b1px); // left fpga (rightChip 0) has no extra 1px offset, but right fpga has
|
||||
const uint32_t b1chip = 256 * b1px;
|
||||
const uint32_t b1line = (nx * b1px);
|
||||
const uint32_t bgroup3chip = b1chip + (group3 ? b1px : 0);
|
||||
|
||||
// copying line by line
|
||||
srcptr = buf;
|
||||
dstptr = tempBuffer + b1line + b1pxofst; // left fpga (index 0) has no extra 1px offset, but right fpga has
|
||||
dstptr = tempBuffer + b1line + b1pxofst; // left fpga (rightChip 0) has no extra 1px offset, but right fpga has
|
||||
for (uint32_t i = 0; i < (ny-1); ++i) {
|
||||
memcpy(dstptr, srcptr, b1chip);
|
||||
srcptr += b1chip;
|
||||
dstptr += (b1chip + b2px);
|
||||
memcpy(dstptr, srcptr, b1chip);
|
||||
srcptr += b1chip;
|
||||
dstptr += (b1chip + b1px);
|
||||
dstptr += bgroup3chip;
|
||||
}
|
||||
|
||||
// vertical filling of values
|
||||
@@ -597,28 +600,36 @@ void DataProcessor::InsertGapPixels(char* buf, uint32_t dr) {
|
||||
dstgp1 = srcgp1 + b1px;
|
||||
srcgp2 = srcgp1 + b3px;
|
||||
dstgp2 = dstgp1 + b1px;
|
||||
if (index == 0u) {
|
||||
srcgp3 = srcptr + b1line - b2px;
|
||||
dstgp3 = srcgp3 + b1px;
|
||||
} else {
|
||||
srcgp3 = srcptr + b1px;
|
||||
dstgp3 = srcptr;
|
||||
if (group3) {
|
||||
if (rightChip == 0u) {
|
||||
srcgp3 = srcptr + b1line - b2px;
|
||||
dstgp3 = srcgp3 + b1px;
|
||||
} else {
|
||||
srcgp3 = srcptr + b1px;
|
||||
dstgp3 = srcptr;
|
||||
}
|
||||
}
|
||||
switch (dr) {
|
||||
case 8:
|
||||
(*((uint8_t*)srcgp1)) = (*((uint8_t*)srcgp1))/2; (*((uint8_t*)dstgp1)) = (*((uint8_t*)srcgp1));
|
||||
(*((uint8_t*)srcgp2)) = (*((uint8_t*)srcgp2))/2; (*((uint8_t*)dstgp2)) = (*((uint8_t*)srcgp2));
|
||||
(*((uint8_t*)srcgp3)) = (*((uint8_t*)srcgp3))/2; (*((uint8_t*)dstgp3)) = (*((uint8_t*)srcgp3));
|
||||
if (group3) {
|
||||
(*((uint8_t*)srcgp3)) = (*((uint8_t*)srcgp3))/2; (*((uint8_t*)dstgp3)) = (*((uint8_t*)srcgp3));
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
(*((uint16_t*)srcgp1)) = (*((uint16_t*)srcgp1))/2; (*((uint16_t*)dstgp1)) = (*((uint16_t*)srcgp1));
|
||||
(*((uint16_t*)srcgp2)) = (*((uint16_t*)srcgp2))/2; (*((uint16_t*)dstgp2)) = (*((uint16_t*)srcgp2));
|
||||
(*((uint16_t*)srcgp3)) = (*((uint16_t*)srcgp3))/2; (*((uint16_t*)dstgp3)) = (*((uint16_t*)srcgp3));
|
||||
if (group3) {
|
||||
(*((uint16_t*)srcgp3)) = (*((uint16_t*)srcgp3))/2; (*((uint16_t*)dstgp3)) = (*((uint16_t*)srcgp3));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
(*((uint32_t*)srcgp1)) = (*((uint32_t*)srcgp1))/2; (*((uint32_t*)dstgp1)) = (*((uint32_t*)srcgp1));
|
||||
(*((uint32_t*)srcgp2)) = (*((uint32_t*)srcgp2))/2; (*((uint32_t*)dstgp2)) = (*((uint32_t*)srcgp2));
|
||||
(*((uint32_t*)srcgp3)) = (*((uint32_t*)srcgp3))/2; (*((uint32_t*)dstgp3)) = (*((uint32_t*)srcgp3));
|
||||
if (group3) {
|
||||
(*((uint32_t*)srcgp3)) = (*((uint32_t*)srcgp3))/2; (*((uint32_t*)dstgp3)) = (*((uint32_t*)srcgp3));
|
||||
}
|
||||
break;
|
||||
}
|
||||
srcptr += b1line;
|
||||
|
||||
@@ -501,7 +501,7 @@ int slsReceiverImplementation::setGapPixelsEnable(const bool b) {
|
||||
gapPixelsEnable = b;
|
||||
|
||||
// side effects
|
||||
generalData->SetGapPixelsEnable(b, dynamicRange);
|
||||
generalData->SetGapPixelsEnable(b, dynamicRange, quadEnable);
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetPixelDimension();
|
||||
if (SetupFifoStructure() == FAIL)
|
||||
@@ -512,10 +512,17 @@ int slsReceiverImplementation::setGapPixelsEnable(const bool b) {
|
||||
}
|
||||
|
||||
|
||||
void slsReceiverImplementation::setQuad(const bool b) {
|
||||
int slsReceiverImplementation::setQuad(const bool b) {
|
||||
if (quadEnable != b) {
|
||||
quadEnable = b;
|
||||
|
||||
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange, b);
|
||||
// to update npixelsx, npixelsy in file writer
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetPixelDimension();
|
||||
if (SetupFifoStructure() == FAIL)
|
||||
return FAIL;
|
||||
|
||||
if (!quadEnable) {
|
||||
for (const auto &it : dataStreamer) {
|
||||
it->SetNumberofDetectors(numDet);
|
||||
@@ -533,6 +540,7 @@ void slsReceiverImplementation::setQuad(const bool b) {
|
||||
}
|
||||
}
|
||||
FILE_LOG(logINFO) << "Quad Enable: " << quadEnable;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int slsReceiverImplementation::setReadOutFlags(const readOutFlags f) {
|
||||
@@ -750,7 +758,7 @@ int slsReceiverImplementation::setNumberofUDPInterfaces(const int n) {
|
||||
fileWriteEnable, &masterFileWriteEnable, &dataStreamEnable,
|
||||
&gapPixelsEnable, &dynamicRange, &streamingFrequency,
|
||||
&streamingTimerInMs, &framePadding, &activated,
|
||||
&deactivatedPaddingEnable, &silentMode, &ctbDbitList,
|
||||
&deactivatedPaddingEnable, &silentMode, &quadEnable, &ctbDbitList,
|
||||
&ctbDbitOffset, &ctbAnalogDataBytes));
|
||||
dataProcessor[i]->SetGeneralData(generalData);
|
||||
} catch (...) {
|
||||
@@ -1085,7 +1093,7 @@ int slsReceiverImplementation::setDynamicRange(const uint32_t i) {
|
||||
if (dynamicRange != i) {
|
||||
dynamicRange = i;
|
||||
generalData->SetDynamicRange(i, tengigaEnable);
|
||||
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange);
|
||||
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange, quadEnable);
|
||||
// to update npixelsx, npixelsy in file writer
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetPixelDimension();
|
||||
@@ -1103,6 +1111,7 @@ int slsReceiverImplementation::setTenGigaEnable(const bool b) {
|
||||
switch (myDetectorType) {
|
||||
case EIGER:
|
||||
generalData->SetTenGigaEnable(b, dynamicRange);
|
||||
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange, quadEnable);
|
||||
break;
|
||||
case MOENCH:
|
||||
generalData->setImageSize(adcEnableMask, numberOfAnalogSamples,
|
||||
@@ -1240,7 +1249,7 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) {
|
||||
&masterFileWriteEnable, &dataStreamEnable, &gapPixelsEnable,
|
||||
&dynamicRange, &streamingFrequency, &streamingTimerInMs,
|
||||
&framePadding, &activated, &deactivatedPaddingEnable,
|
||||
&silentMode, &ctbDbitList, &ctbDbitOffset,
|
||||
&silentMode, &quadEnable, &ctbDbitList, &ctbDbitOffset,
|
||||
&ctbAnalogDataBytes));
|
||||
} catch (...) {
|
||||
FILE_LOG(logERROR)
|
||||
|
||||
@@ -1314,7 +1314,10 @@ int slsReceiverTCPIPInterface::set_quad_type(Interface &socket) {
|
||||
if (quadEnable >= 0) {
|
||||
VerifyIdle(socket);
|
||||
FILE_LOG(logDEBUG1) << "Setting quad:" << quadEnable;
|
||||
impl()->setQuad(quadEnable == 0 ? false : true);
|
||||
ret = impl()->setQuad(quadEnable == 0 ? false : true);
|
||||
if (ret == FAIL) {
|
||||
throw RuntimeError("Could not set Quad due to fifo structure");
|
||||
}
|
||||
}
|
||||
int retval = impl()->getQuad() ? 1 : 0;
|
||||
validate(quadEnable, retval, "set quad", DEC);
|
||||
|
||||
Reference in New Issue
Block a user