ctb: adcenable10g included, 10g readout enables included

This commit is contained in:
2019-11-27 17:28:57 +01:00
parent f299a34e59
commit 9455a5fba1
25 changed files with 507 additions and 198 deletions

View File

@ -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);
}

View File

@ -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);