moench: first version

This commit is contained in:
2020-03-02 18:34:10 +01:00
parent d7319968a7
commit 6bbcf6173d
27 changed files with 1452 additions and 1350 deletions

View File

@@ -336,6 +336,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->roMode = ANALOG_ONLY;
shm()->currentSettings = UNINITIALIZED;
shm()->currentThresholdEV = -1;
shm()->nASamples = 1;
shm()->nFrames = 1;
shm()->nTriggers = 1;
shm()->nBursts = 1;
@@ -557,8 +558,8 @@ slsDetectorDefs::detectorType slsDetector::getDetectorType() const {
}
void slsDetector::updateNumberOfChannels() {
if (shm()->myDetectorType == CHIPTESTBOARD ||
shm()->myDetectorType == MOENCH) {
if (shm()->myDetectorType == CHIPTESTBOARD) {
int nachans = 0, ndchans = 0;
// analog channels (normal, analog/digital readout)
@@ -577,15 +578,29 @@ void slsDetector::updateNumberOfChannels() {
}
// digital channels (ctb only, digital, analog/digital readout)
if (shm()->myDetectorType == CHIPTESTBOARD &&
(shm()->roMode == DIGITAL_ONLY ||
shm()->roMode == ANALOG_AND_DIGITAL)) {
if (shm()->roMode == DIGITAL_ONLY ||
shm()->roMode == ANALOG_AND_DIGITAL) {
ndchans = 64;
FILE_LOG(logDEBUG1) << "#Digital Channels:" << ndchans;
}
shm()->nChan.x = nachans + ndchans;
FILE_LOG(logDEBUG1) << "# Total #Channels:" << shm()->nChan.x;
}
else if (shm()->myDetectorType == MOENCH) {
uint32_t mask = shm()->tenGigaEnable ? shm()->adcEnableMaskTenGiga : shm()->adcEnableMaskOneGiga;
// count number of channels in x, each adc has 25 channels each
int nchanTop = __builtin_popcount(mask & 0xF0F0F0F0) * 25;
int nchanBot = __builtin_popcount(mask & 0x0F0F0F0F) * 25;
shm()->nChan.x = nchanTop > 0 ? nchanTop : nchanBot;
// if both top and bottom adcs enabled, rows = 2
int nrows = 1;
if (nchanTop > 0 && nchanBot > 0) {
nrows = 2;
}
shm()->nChan.y = shm()->nASamples / 25 * nrows;
}
}
slsDetectorDefs::xy slsDetector::getNumberOfChannels() const {
@@ -807,11 +822,18 @@ void slsDetector::updateCachedDetectorVariables() {
shm()->tenGigaEnable = static_cast<bool>(i32);
}
// analog samples and adc enable masks
if (shm()->myDetectorType == CHIPTESTBOARD ||
shm()->myDetectorType == MOENCH) {
// 1gb adcmask
// analog samples
uint32_t u32 = 0;
n += client.Receive(&u32, sizeof(u32));
shm()->nASamples = u32;
// 1gb adcmask
u32 = 0;
n += client.Receive(&u32, sizeof(u32));
shm()->adcEnableMaskOneGiga = u32;
// 10gb adcmask
@@ -1321,6 +1343,7 @@ int slsDetector::getNumberOfAnalogSamples() {
void slsDetector::setNumberOfAnalogSamples(int value) {
FILE_LOG(logDEBUG1) << "Setting number of analog samples to " << value;
sendToDetector(F_SET_NUM_ANALOG_SAMPLES, value, nullptr);
shm()->nASamples = value;
// update #nchan, as it depends on #samples, adcmask
updateNumberOfChannels();
if (shm()->useReceiverFlag) {
@@ -1836,7 +1859,6 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
case MOENCH:
setNumberOfAnalogSamples(getNumberOfAnalogSamples());
setNumberOfDigitalSamples(getNumberOfDigitalSamples());
enableTenGigabitEthernet(static_cast<int>(shm()->tenGigaEnable));
setADCEnableMask(shm()->adcEnableMaskOneGiga);
setTenGigaADCEnableMask(shm()->adcEnableMaskTenGiga);
@@ -2974,6 +2996,7 @@ void slsDetector::programFPGA(std::vector<char> buffer) {
switch (shm()->myDetectorType) {
case JUNGFRAU:
case CHIPTESTBOARD:
case MOENCH:
programFPGAviaBlackfin(buffer);
break;
case MYTHEN3: