mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
ctb: adcenable10g included, 10g readout enables included
This commit is contained in:
@ -118,6 +118,7 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int set_udp_port(sls::ServerInterface2 &socket);
|
||||
int set_udp_port2(sls::ServerInterface2 &socket);
|
||||
int set_num_interfaces(sls::ServerInterface2 &socket);
|
||||
int set_adc_mask_10g(sls::ServerInterface2 &socket);
|
||||
|
||||
detectorType myDetectorType;
|
||||
std::unique_ptr<Implementation> receiver{nullptr};
|
||||
|
@ -632,20 +632,21 @@ public:
|
||||
nPixelsY = 1;
|
||||
// 10G
|
||||
if (t) {
|
||||
/*
|
||||
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
|
||||
dataSize = UDP_PACKET_DATA_BYTES;
|
||||
dataSize = 464;
|
||||
packetSize = headerSizeinPacket + dataSize;
|
||||
imageSize = adatabytes + ddatabytes;
|
||||
packetsPerFrame = ceil((double)imageSize / (double)dataSize);
|
||||
standardheader = true;
|
||||
*/
|
||||
|
||||
/*
|
||||
headerSizeinPacket = 22;
|
||||
dataSize = 8192;
|
||||
packetSize = headerSizeinPacket + dataSize;
|
||||
imageSize = adatabytes + ddatabytes;
|
||||
packetsPerFrame = ceil((double)imageSize / (double)dataSize);
|
||||
standardheader = false;
|
||||
*/
|
||||
}
|
||||
// 1g udp (via fifo readout)
|
||||
else {
|
||||
|
@ -186,6 +186,9 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
uint32_t getADCEnableMask() const;
|
||||
/* [Ctb][Moench] */
|
||||
int setADCEnableMask(const uint32_t mask);
|
||||
uint32_t getTenGigaADCEnableMask() const;
|
||||
/* [Ctb][Moench] */
|
||||
int setTenGigaADCEnableMask(const uint32_t mask);
|
||||
std::vector<int> getDbitList() const;
|
||||
/* [Ctb] */
|
||||
void setDbitList(const std::vector<int> v);
|
||||
@ -284,7 +287,8 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
bool deactivatedPaddingEnable;
|
||||
int numLinesReadout;
|
||||
readoutMode readoutType;
|
||||
uint32_t adcEnableMask;
|
||||
uint32_t adcEnableMaskOneGiga;
|
||||
uint32_t adcEnableMaskTenGiga;
|
||||
std::vector<int> ctbDbitList;
|
||||
int ctbDbitOffset;
|
||||
int ctbAnalogDataBytes;
|
||||
|
@ -203,6 +203,8 @@ int ClientInterface::function_table(){
|
||||
flist[F_SET_RECEIVER_UDP_PORT] = &ClientInterface::set_udp_port;
|
||||
flist[F_SET_RECEIVER_UDP_PORT2] = &ClientInterface::set_udp_port2;
|
||||
flist[F_SET_RECEIVER_NUM_INTERFACES] = &ClientInterface::set_num_interfaces;
|
||||
flist[F_RECEIVER_SET_ADC_MASK_10G] = &ClientInterface::set_adc_mask_10g;
|
||||
|
||||
|
||||
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
// FILE_LOG(logDEBUG1) << "function fnum: " << i << " (" <<
|
||||
@ -1137,16 +1139,16 @@ int ClientInterface::set_readout_mode(Interface &socket) {
|
||||
int ClientInterface::set_adc_mask(Interface &socket) {
|
||||
auto arg = socket.Receive<uint32_t>();
|
||||
VerifyIdle(socket);
|
||||
FILE_LOG(logDEBUG1) << "Setting ADC enable mask: " << arg;
|
||||
FILE_LOG(logDEBUG1) << "Setting 1Gb ADC enable mask: " << arg;
|
||||
impl()->setADCEnableMask(arg);
|
||||
auto retval = impl()->getADCEnableMask();
|
||||
if (retval != arg) {
|
||||
std::ostringstream os;
|
||||
os << "Could not ADC enable mask. Set 0x" << std::hex << arg
|
||||
os << "Could not set 1Gb ADC enable mask. Set 0x" << std::hex << arg
|
||||
<< " but read 0x" << std::hex << retval;
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << "ADC enable mask retval: " << retval;
|
||||
FILE_LOG(logDEBUG1) << "1Gb ADC enable mask retval: " << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
@ -1298,4 +1300,20 @@ int ClientInterface::set_num_interfaces(Interface &socket) {
|
||||
throw RuntimeError("Failed to set number of interfaces");
|
||||
}
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_adc_mask_10g(Interface &socket) {
|
||||
auto arg = socket.Receive<uint32_t>();
|
||||
VerifyIdle(socket);
|
||||
FILE_LOG(logDEBUG1) << "Setting 10Gb ADC enable mask: " << arg;
|
||||
impl()->setTenGigaADCEnableMask(arg);
|
||||
auto retval = impl()->getTenGigaADCEnableMask();
|
||||
if (retval != arg) {
|
||||
std::ostringstream os;
|
||||
os << "Could not 10gb ADC enable mask. Set 0x" << std::hex << arg
|
||||
<< " but read 0x" << std::hex << retval;
|
||||
throw RuntimeError(os.str());
|
||||
}
|
||||
FILE_LOG(logDEBUG1) << "10Gb ADC enable mask retval: " << retval;
|
||||
return socket.sendResult(retval);
|
||||
}
|
@ -111,7 +111,9 @@ void Implementation::InitializeMembers() {
|
||||
deactivatedPaddingEnable = true;
|
||||
numLinesReadout = MAX_EIGER_ROWS_PER_READOUT;
|
||||
readoutType = ANALOG_ONLY;
|
||||
adcEnableMask = BIT32_MASK;
|
||||
adcEnableMaskOneGiga = BIT32_MASK;
|
||||
adcEnableMaskTenGiga = BIT32_MASK;
|
||||
|
||||
ctbDbitOffset = 0;
|
||||
ctbAnalogDataBytes = 0;
|
||||
|
||||
@ -882,7 +884,7 @@ int Implementation::SetupWriter() {
|
||||
attr.quadEnable = quadEnable;
|
||||
attr.analogFlag = (readoutType == ANALOG_ONLY || readoutType == ANALOG_AND_DIGITAL) ? 1 : 0;
|
||||
attr.digitalFlag = (readoutType == DIGITAL_ONLY || readoutType == ANALOG_AND_DIGITAL) ? 1 : 0;
|
||||
attr.adcmask = adcEnableMask;
|
||||
attr.adcmask = tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga;
|
||||
attr.dbitoffset = ctbDbitOffset;
|
||||
attr.dbitlist = 0;
|
||||
attr.roiXmin = roi.xmin;
|
||||
@ -1310,7 +1312,8 @@ int Implementation::setNumberofAnalogSamples(const uint32_t i) {
|
||||
numberOfAnalogSamples = i;
|
||||
|
||||
ctbAnalogDataBytes = generalData->setImageSize(
|
||||
adcEnableMask, numberOfAnalogSamples, numberOfDigitalSamples,
|
||||
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga,
|
||||
numberOfAnalogSamples, numberOfDigitalSamples,
|
||||
tengigaEnable, readoutType);
|
||||
|
||||
for (const auto &it : dataProcessor)
|
||||
@ -1334,7 +1337,8 @@ int Implementation::setNumberofDigitalSamples(const uint32_t i) {
|
||||
numberOfDigitalSamples = i;
|
||||
|
||||
ctbAnalogDataBytes = generalData->setImageSize(
|
||||
adcEnableMask, numberOfAnalogSamples, numberOfDigitalSamples,
|
||||
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga,
|
||||
numberOfAnalogSamples, numberOfDigitalSamples,
|
||||
tengigaEnable, readoutType);
|
||||
|
||||
for (const auto &it : dataProcessor)
|
||||
@ -1415,7 +1419,8 @@ int Implementation::setTenGigaEnable(const bool b) {
|
||||
case MOENCH:
|
||||
case CHIPTESTBOARD:
|
||||
ctbAnalogDataBytes = generalData->setImageSize(
|
||||
adcEnableMask, numberOfAnalogSamples, numberOfDigitalSamples,
|
||||
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga,
|
||||
numberOfAnalogSamples, numberOfDigitalSamples,
|
||||
tengigaEnable, readoutType);
|
||||
break;
|
||||
default:
|
||||
@ -1558,7 +1563,8 @@ int Implementation::setReadoutMode(const readoutMode f) {
|
||||
|
||||
// side effects
|
||||
ctbAnalogDataBytes = generalData->setImageSize(
|
||||
adcEnableMask, numberOfAnalogSamples, numberOfDigitalSamples,
|
||||
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga,
|
||||
numberOfAnalogSamples, numberOfDigitalSamples,
|
||||
tengigaEnable, readoutType);
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetPixelDimension();
|
||||
@ -1574,15 +1580,16 @@ int Implementation::setReadoutMode(const readoutMode f) {
|
||||
|
||||
uint32_t Implementation::getADCEnableMask() const {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return adcEnableMask;
|
||||
return adcEnableMaskOneGiga;
|
||||
}
|
||||
|
||||
int Implementation::setADCEnableMask(uint32_t mask) {
|
||||
if (adcEnableMask != mask) {
|
||||
adcEnableMask = mask;
|
||||
if (adcEnableMaskOneGiga != mask) {
|
||||
adcEnableMaskOneGiga = mask;
|
||||
|
||||
ctbAnalogDataBytes = generalData->setImageSize(
|
||||
mask, numberOfAnalogSamples, numberOfDigitalSamples,
|
||||
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga,
|
||||
numberOfAnalogSamples, numberOfDigitalSamples,
|
||||
tengigaEnable, readoutType);
|
||||
|
||||
for (const auto &it : dataProcessor)
|
||||
@ -1591,7 +1598,34 @@ int Implementation::setADCEnableMask(uint32_t mask) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO) << "ADC Enable Mask: 0x" << std::hex << adcEnableMask
|
||||
FILE_LOG(logINFO) << "ADC Enable Mask for 1Gb mode: 0x" << std::hex << adcEnableMaskOneGiga
|
||||
<< std::dec;
|
||||
FILE_LOG(logINFO) << "Packets per Frame: "
|
||||
<< (generalData->packetsPerFrame);
|
||||
return OK;
|
||||
}
|
||||
|
||||
uint32_t Implementation::getTenGigaADCEnableMask() const {
|
||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||
return adcEnableMaskTenGiga;
|
||||
}
|
||||
|
||||
int Implementation::setTenGigaADCEnableMask(uint32_t mask) {
|
||||
if (adcEnableMaskTenGiga != mask) {
|
||||
adcEnableMaskTenGiga = mask;
|
||||
|
||||
ctbAnalogDataBytes = generalData->setImageSize(
|
||||
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga,
|
||||
numberOfAnalogSamples, numberOfDigitalSamples,
|
||||
tengigaEnable, readoutType);
|
||||
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetPixelDimension();
|
||||
if (SetupFifoStructure() == FAIL)
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO) << "ADC Enable Mask for 10Gb mode: 0x" << std::hex << adcEnableMaskTenGiga
|
||||
<< std::dec;
|
||||
FILE_LOG(logINFO) << "Packets per Frame: "
|
||||
<< (generalData->packetsPerFrame);
|
||||
|
Reference in New Issue
Block a user