Counters (#71)

* mythen3: adding counters mask, firmware still takes only number of counters for now

* mythen3: checking if module attached before powering on chip

* bug fix: loop inital declaration not allowed in c

* fix scope eiger test

* mythen3: renamed setCounters to setCounterMask and getCounterMask in API

* mythen3 replacing counting bits with popcount

Co-authored-by: Erik Fröjdh <erik.frojdh@gmail.com>
This commit is contained in:
Dhanya Thattil
2020-01-14 17:40:46 +01:00
committed by Erik Fröjdh
parent 70c54f4315
commit de53747ddd
26 changed files with 742 additions and 759 deletions

View File

@ -174,7 +174,7 @@ int ClientInterface::functionTable(){
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;
flist[F_RECEIVER_SET_NUM_COUNTERS] = &ClientInterface::set_num_counters;
for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) {
FILE_LOG(logDEBUG1) << "function fnum: " << i << " (" <<
@ -1319,4 +1319,12 @@ int ClientInterface::set_adc_mask_10g(Interface &socket) {
}
FILE_LOG(logDEBUG1) << "10Gb ADC enable mask retval: " << retval;
return socket.sendResult(retval);
}
int ClientInterface::set_num_counters(Interface &socket) {
auto arg = socket.Receive<int>();
verifyIdle(socket);
FILE_LOG(logDEBUG1) << "Setting counters: " << arg;
impl()->setNumberofCounters(arg);
return socket.Send(OK);
}

View File

@ -101,6 +101,7 @@ void Implementation::InitializeMembers() {
subPeriod = 0;
numberOfAnalogSamples = 0;
numberOfDigitalSamples = 0;
numberOfCounters = 0;
dynamicRange = 16;
roi.xmin = -1;
roi.xmax = -1;
@ -1287,6 +1288,26 @@ void Implementation::setNumberofDigitalSamples(const uint32_t i) {
<< (generalData->packetsPerFrame);
}
int Implementation::getNumberofCounters() const {
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
return numberOfCounters;
}
void Implementation::setNumberofCounters(const int i) {
if (numberOfCounters != i) {
numberOfCounters = i;
if (myDetectorType == MYTHEN3) {
generalData->SetDynamicRange(i, tengigaEnable);
// to update npixelsx, npixelsy in file writer
for (const auto &it : dataProcessor)
it->SetPixelDimension();
SetupFifoStructure();
}
}
FILE_LOG(logINFO) << "Number of Counters: " << numberOfCounters;
}
uint32_t Implementation::getDynamicRange() const {
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
return dynamicRange;
@ -1297,9 +1318,11 @@ void Implementation::setDynamicRange(const uint32_t i) {
if (dynamicRange != i) {
dynamicRange = i;
if (myDetectorType == EIGER) {
if (myDetectorType == EIGER || myDetectorType == MYTHEN3) {
generalData->SetDynamicRange(i, tengigaEnable);
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange, quadEnable);
if (myDetectorType == EIGER) {
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange, quadEnable);
}
// to update npixelsx, npixelsy in file writer
for (const auto &it : dataProcessor)
it->SetPixelDimension();