ctb server: including moench as well for programfpga and other client ctb implementations

This commit is contained in:
2019-02-21 16:00:40 +01:00
parent 617f3d2600
commit 421dbdb9b5

View File

@ -84,6 +84,9 @@ int slsDetector::checkDetectorVersionCompatibility() {
case CHIPTESTBOARD: case CHIPTESTBOARD:
arg = APICTB; arg = APICTB;
break; break;
case MOENCH:
arg = APIMOENCH;
break;
default: default:
FILE_LOG(logERROR) << "Check version compatibility is not implemented for this detector"; FILE_LOG(logERROR) << "Check version compatibility is not implemented for this detector";
setErrorMask((getErrorMask()) | (VERSION_COMPATIBILITY)); setErrorMask((getErrorMask()) | (VERSION_COMPATIBILITY));
@ -290,6 +293,7 @@ void slsDetector::setDetectorSpecificParameters(detectorType type, detParameterL
list.nGappixelsY = 0; list.nGappixelsY = 0;
break; break;
case CHIPTESTBOARD: case CHIPTESTBOARD:
case MOENCH:
list.nChanX = 36; list.nChanX = 36;
list.nChanY = 1; list.nChanY = 1;
list.nChipX = 1; list.nChipX = 1;
@ -420,6 +424,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
thisDetector->receiver_framesPerFile = JFRAU_MAX_FRAMES_PER_FILE; thisDetector->receiver_framesPerFile = JFRAU_MAX_FRAMES_PER_FILE;
break; break;
case CHIPTESTBOARD: case CHIPTESTBOARD:
case MOENCH:
thisDetector->receiver_framesPerFile = JFRAU_MAX_FRAMES_PER_FILE; thisDetector->receiver_framesPerFile = JFRAU_MAX_FRAMES_PER_FILE;
break; break;
default: default:
@ -455,7 +460,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
thisDetector->dynamicRange / 8; thisDetector->dynamicRange / 8;
// special for jctb // special for jctb
if (thisDetector->myDetectorType == CHIPTESTBOARD) { if (thisDetector->myDetectorType == CHIPTESTBOARD || thisDetector->myDetectorType == MOENCH) {
getTotalNumberOfChannels(); getTotalNumberOfChannels();
} }
@ -735,7 +740,7 @@ std::string slsDetector::getDetectorTypeAsString() {
int slsDetector::getTotalNumberOfChannels() { int slsDetector::getTotalNumberOfChannels() {
FILE_LOG(logDEBUG1) << "Get total number of channels"; FILE_LOG(logDEBUG1) << "Get total number of channels";
if (thisDetector->myDetectorType == CHIPTESTBOARD) { if (thisDetector->myDetectorType == CHIPTESTBOARD || thisDetector->myDetectorType == MOENCH) {
if (thisDetector->roFlags & DIGITAL_ONLY) { if (thisDetector->roFlags & DIGITAL_ONLY) {
thisDetector->nChan[X] = 4; thisDetector->nChan[X] = 4;
} else if (thisDetector->roFlags & ANALOG_AND_DIGITAL) { } else if (thisDetector->roFlags & ANALOG_AND_DIGITAL) {
@ -1187,6 +1192,10 @@ int slsDetector::writeConfigurationFile(std::ofstream &outfile, multiSlsDetector
case CHIPTESTBOARD: case CHIPTESTBOARD:
names.emplace_back("vhighvoltage"); names.emplace_back("vhighvoltage");
break; break;
case MOENCH:
names.emplace_back("powerchip");
names.emplace_back("vhighvoltage");
break;
default: default:
FILE_LOG(logERROR) << "Unknown detector type " << thisDetector->myDetectorType; FILE_LOG(logERROR) << "Unknown detector type " << thisDetector->myDetectorType;
setErrorMask((getErrorMask()) | (OTHER_ERROR_CODE)); setErrorMask((getErrorMask()) | (OTHER_ERROR_CODE));
@ -2049,7 +2058,7 @@ int slsDetector::setDynamicRange(int n) {
(thisDetector->nChip[Y] * thisDetector->nChan[Y] + (thisDetector->nChip[Y] * thisDetector->nChan[Y] +
thisDetector->gappixels * thisDetector->nGappixels[Y]) * thisDetector->gappixels * thisDetector->nGappixels[Y]) *
retval / 8; retval / 8;
if (thisDetector->myDetectorType == CHIPTESTBOARD) { if (thisDetector->myDetectorType == CHIPTESTBOARD || thisDetector->myDetectorType == MOENCH) {
getTotalNumberOfChannels(); getTotalNumberOfChannels();
} }
FILE_LOG(logDEBUG1) << "Data bytes " << thisDetector->dataBytes; FILE_LOG(logDEBUG1) << "Data bytes " << thisDetector->dataBytes;
@ -2383,7 +2392,7 @@ std::string slsDetector::setReceiver(const std::string &receiverIP) {
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]); thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]);
setTimer(SUBFRAME_DEADTIME, thisDetector->timerValue[SUBFRAME_DEADTIME]); setTimer(SUBFRAME_DEADTIME, thisDetector->timerValue[SUBFRAME_DEADTIME]);
} }
if (thisDetector->myDetectorType == CHIPTESTBOARD) { if (thisDetector->myDetectorType == CHIPTESTBOARD || thisDetector->myDetectorType == MOENCH) {
setTimer(SAMPLES, thisDetector->timerValue[SAMPLES]); setTimer(SAMPLES, thisDetector->timerValue[SAMPLES]);
} }
setDynamicRange(thisDetector->dynamicRange); setDynamicRange(thisDetector->dynamicRange);
@ -3032,7 +3041,7 @@ int slsDetector::setROI(int n, ROI roiLimits[]) {
int ret = sendROI(n, roiLimits); int ret = sendROI(n, roiLimits);
if(ret==FAIL) if(ret==FAIL)
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI)); setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
if (thisDetector->myDetectorType == CHIPTESTBOARD) { if (thisDetector->myDetectorType == CHIPTESTBOARD || thisDetector->myDetectorType == MOENCH) {
getTotalNumberOfChannels(); getTotalNumberOfChannels();
} }
return ret; return ret;
@ -3041,7 +3050,7 @@ int slsDetector::setROI(int n, ROI roiLimits[]) {
slsDetectorDefs::ROI *slsDetector::getROI(int &n) { slsDetectorDefs::ROI *slsDetector::getROI(int &n) {
sendROI(-1, nullptr); sendROI(-1, nullptr);
n = thisDetector->nROI; n = thisDetector->nROI;
if (thisDetector->myDetectorType == CHIPTESTBOARD) { if (thisDetector->myDetectorType == CHIPTESTBOARD || thisDetector->myDetectorType == MOENCH) {
getTotalNumberOfChannels(); getTotalNumberOfChannels();
} }
return thisDetector->roiLimits; return thisDetector->roiLimits;
@ -3499,7 +3508,8 @@ int slsDetector::setStoragecellStart(int pos) {
int slsDetector::programFPGA(const std::string &fname) { int slsDetector::programFPGA(const std::string &fname) {
// only jungfrau implemented (client processing, so check now) // only jungfrau implemented (client processing, so check now)
if (thisDetector->myDetectorType != JUNGFRAU && thisDetector->myDetectorType != CHIPTESTBOARD) { if (thisDetector->myDetectorType != JUNGFRAU &&
thisDetector->myDetectorType != CHIPTESTBOARD && thisDetector->myDetectorType != MOENCH) {
FILE_LOG(logERROR) << "Not implemented for this detector"; FILE_LOG(logERROR) << "Not implemented for this detector";
setErrorMask((getErrorMask()) | (PROGRAMMING_ERROR)); setErrorMask((getErrorMask()) | (PROGRAMMING_ERROR));
return FAIL; return FAIL;
@ -3528,7 +3538,7 @@ int slsDetector::programFPGA(const std::string &fname) {
} }
// create temp destination file // create temp destination file
char destfname[] = "/tmp/Jungfrau_MCB.XXXXXX"; char destfname[] = "/tmp/SLS_DET_MCB.XXXXXX";
int dst = mkstemp(destfname); // create temporary file and open it in r/w int dst = mkstemp(destfname); // create temporary file and open it in r/w
if (dst == -1) { if (dst == -1) {
FILE_LOG(logERROR) << "Could not create destination file in /tmp for programming: " << destfname; FILE_LOG(logERROR) << "Could not create destination file in /tmp for programming: " << destfname;