diff --git a/slsDetectorSoftware/Makefile b/slsDetectorSoftware/Makefile index 7c3bc3293..75d297714 100644 --- a/slsDetectorSoftware/Makefile +++ b/slsDetectorSoftware/Makefile @@ -1,5 +1,5 @@ CFLAGS= -DC_ONLY -#FLAGS=-DVERBOSE +FLAGS=-DVERBOSE INCLUDES= -IcommonFiles -IslsDetector -IMySocketTCP -IusersFunctions -ImultiSlsDetector -IslsDetectorUtils -IslsDetectorCommand #-I eigerDetector -ImythenDetector -IgotthardDetector #EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/SL5-x86/ -Wl,-R/usr/local/epics/base/lib/SL5-x86 -lca -lCom diff --git a/slsDetectorSoftware/commonFiles/communication_funcs.c b/slsDetectorSoftware/commonFiles/communication_funcs.c index 5ee53ee38..0e29c3455 100755 --- a/slsDetectorSoftware/commonFiles/communication_funcs.c +++ b/slsDetectorSoftware/commonFiles/communication_funcs.c @@ -347,7 +347,7 @@ int sendChip(int file_des, sls_detector_chip *myChip) { int sendModule(int file_des, sls_detector_module *myMod) { int ts=0; - int idac; + //int idac; int nChips=myMod->nchip; int nChans=myMod->nchan; int nAdcs=myMod->nadc; diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 77a971275..ff1f9404e 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -557,15 +557,23 @@ int multiSlsDetector::setMaster(int i) { int ret=-1, slave=0; masterFlags f; - +#ifdef VERBOSE + cout << "settin master in position " << i << endl; +#endif if (i>=0 && inumberOfDetectors) { if (detectors[i]) { +#ifdef VERBOSE + cout << "detector position " << i << " "; +#endif thisMultiDetector->masterPosition=i; detectors[i]->setMaster(IS_MASTER); } for (int id=0; idnumberOfDetectors; id++) { if (i!=id) { if (detectors[id]) { +#ifdef VERBOSE + cout << "detector position " << id << " "; +#endif detectors[id]->setMaster(IS_SLAVE); } } @@ -574,15 +582,22 @@ int multiSlsDetector::setMaster(int i) { } else if (i==-2) { for (int id=0; idnumberOfDetectors; id++) { if (detectors[id]) { +#ifdef VERBOSE + cout << "detector position " << id << " "; +#endif detectors[id]->setMaster(NO_MASTER); } } } + // check return value for (int id=0; idnumberOfDetectors; id++) { if (detectors[id]) { +#ifdef VERBOSE + cout << "detector position " << id << " "; +#endif f=detectors[id]->setMaster(GET_MASTER); switch (f) { case NO_MASTER: @@ -597,6 +612,7 @@ int multiSlsDetector::setMaster(int i) { break; case IS_SLAVE: slave=1; + break; default: ret=-2; } @@ -2832,6 +2848,7 @@ int multiSlsDetector::dumpDetectorSetup(string const fname, int level){ "frames",\ "cycles",\ "probes",\ + "timing",\ "fineoff",\ "ratecorr",\ "startscript",\ @@ -2858,7 +2875,7 @@ int multiSlsDetector::dumpDetectorSetup(string const fname, int level){ "badchannels",\ "angconv" }; - int nvar=38; + int nvar=39; diff --git a/slsDetectorSoftware/mythenDetectorServer/firmware_funcs.c b/slsDetectorSoftware/mythenDetectorServer/firmware_funcs.c index 479925fa7..650f70e9b 100755 --- a/slsDetectorSoftware/mythenDetectorServer/firmware_funcs.c +++ b/slsDetectorSoftware/mythenDetectorServer/firmware_funcs.c @@ -44,7 +44,7 @@ u_int32_t progressMask=0; int ififostart, ififostop, ififostep, ififo; -int masterMode=NO_MASTER, syncMode=NO_SYNCHRONIZATION; +int masterMode=NO_MASTER, syncMode=NO_SYNCHRONIZATION, timingMode=AUTO_TIMING; enum externalSignalFlag signals[4]={EXT_SIG_OFF, EXT_SIG_OFF, EXT_SIG_OFF, EXT_SIG_OFF}; @@ -244,21 +244,52 @@ u_int32_t getTotDutyCycle() { u_int32_t setExtSignal(int d, enum externalSignalFlag mode) { - int modes[]={EXT_SIG_OFF, EXT_GATE_IN_ACTIVEHIGH, EXT_GATE_IN_ACTIVELOW,EXT_TRIG_IN_RISING,EXT_TRIG_IN_FALLING,EXT_RO_TRIG_IN_RISING, EXT_RO_TRIG_IN_FALLING,EXT_GATE_OUT_ACTIVEHIGH, EXT_GATE_OUT_ACTIVELOW, EXT_TRIG_OUT_RISING, EXT_TRIG_OUT_FALLING, EXT_RO_TRIG_OUT_RISING, EXT_RO_TRIG_OUT_FALLING}; + // int modes[]={EXT_SIG_OFF, EXT_GATE_IN_ACTIVEHIGH, EXT_GATE_IN_ACTIVELOW,EXT_TRIG_IN_RISING,EXT_TRIG_IN_FALLING,EXT_RO_TRIG_IN_RISING, EXT_RO_TRIG_IN_FALLING,EXT_GATE_OUT_ACTIVEHIGH, EXT_GATE_OUT_ACTIVELOW, EXT_TRIG_OUT_RISING, EXT_TRIG_OUT_FALLING, EXT_RO_TRIG_OUT_RISING, EXT_RO_TRIG_OUT_FALLING}; u_int32_t c; - int off=d*SIGNAL_OFFSET; + // int off=d*SIGNAL_OFFSET; c=bus_r(EXT_SIGNAL_REG); if (d>=0 && d<4) { signals[d]=mode; - - // if output signal, set it! +#ifdef VERBOSE + printf("settings signal variable number %d to value %04x\n", d, signals[d]); +#endif - if (mode<=RO_TRIGGER_OUT_FALLING_EDGE && mode>=GATE_OUT_ACTIVE_HIGH && signals[d]!=MASTER_SLAVE_SYNCHRONIZATION) - bus_w(EXT_SIGNAL_REG,((modes[mode])<=0) - bus_w(EXT_SIGNAL_REG,((modes[mode])<=0) { +#ifdef VERBOSE + printf("writing signal register number %d mode %04x\n",d, modes[mode]); +#endif + bus_w(EXT_SIGNAL_REG,((modes[mode])<=0 && d<4) + if (d>=0 && d<4) { +#ifdef VERBOSE + printf("gettings signal variable number %d value %04x\n", d, signals[d]); +#endif return signals[d]; - else + } else return -1; } @@ -308,9 +346,14 @@ int getFPGASignal(int d) { int off=d*SIGNAL_OFFSET; int mode=((bus_r(EXT_SIGNAL_REG)&(SIGNAL_MASK<>off); - if (mode0 && getFPGASignal(i)=0) { @@ -705,7 +705,7 @@ int getThresholdEnergy() { float g[3]=DEFAULTGAIN; float o[3]=DEFAULTOFFSET; float myg=-1, myo=-1; - int dacu; + // int dacu; int imod; int ethr=-1; int ret=FAIL; diff --git a/slsDetectorSoftware/mythenDetectorServer/server_funcs.c b/slsDetectorSoftware/mythenDetectorServer/server_funcs.c index 0b354c3b6..ef38daf3e 100755 --- a/slsDetectorSoftware/mythenDetectorServer/server_funcs.c +++ b/slsDetectorSoftware/mythenDetectorServer/server_funcs.c @@ -58,13 +58,16 @@ int init_detector( int b) { #endif #endif testFpga(); -#ifdef MCB_FUNCS if (b) { +#ifdef MCB_FUNCS initDetector(); setSettings(GET_SETTINGS); testRAM(); - } #endif + setTiming(GET_EXTERNAL_COMMUNICATION_MODE); + setMaster(GET_MASTER); + setSynchronization(GET_SYNCHRONIZATION_MODE); + } strcpy(mess,"dummy message"); strcpy(lastClientIP,"none"); strcpy(thisClientIP,"none1"); @@ -1313,7 +1316,7 @@ int set_module(int file_des) { float *myAdc=malloc(NADC*sizeof(int)); int retval, n; int ret=OK; - int dr, ow; + int dr;//, ow; dr=setDynamicRange(-1); @@ -2624,7 +2627,7 @@ int send_update(int file_des) { int ret=OK; enum detectorSettings t; int thr, n; - int it; + // int it; int64_t retval, tns=-1; @@ -2678,7 +2681,7 @@ int set_master(int file_des) { enum masterFlags arg; int n; int ret=OK; - int regret=OK; + // int regret=OK; sprintf(mess,"can't set master flags\n"); @@ -2725,7 +2728,7 @@ int set_synchronization(int file_des) { enum synchronizationMode arg; int n; int ret=OK; - int regret=OK; + //int regret=OK; sprintf(mess,"can't set synchronization mode\n"); diff --git a/slsDetectorSoftware/mythenDetectorServer/trimming_funcs.c b/slsDetectorSoftware/mythenDetectorServer/trimming_funcs.c index be87001ca..b86e9f3f4 100755 --- a/slsDetectorSoftware/mythenDetectorServer/trimming_funcs.c +++ b/slsDetectorSoftware/mythenDetectorServer/trimming_funcs.c @@ -44,7 +44,7 @@ int trim_with_noise(int countlim, int nsigma, int im) { - int retval=OK, retval1=OK, retval2=OK; + int retval1=OK, retval2=OK; #ifdef VERBOSE printf("Trimming using noise\n"); #endif @@ -83,7 +83,7 @@ int trim_with_beam(int countlim, int nsigma, int im) //rpc { - int retval=OK, retval1=OK, retval2=OK; + int retval1=OK, retval2=OK; printf("Trimming using beam\n"); //return OK; @@ -118,7 +118,7 @@ int trim_with_beam(int countlim, int nsigma, int im) //rpc int trim_improve(int maxit, int par2, int im) //rpc { - int retval=OK, retval1=OK, retval2=OK; + int retval1=OK, retval2=OK; #ifdef VERBOSE diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 162abfa45..c915c29b6 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -4864,6 +4864,7 @@ int slsDetector::dumpDetectorSetup(string const fname, int level){ "frames",\ "cycles",\ "probes",\ + "timing",\ "fineoff",\ "ratecorr",\ "startscript",\ @@ -4892,7 +4893,7 @@ int slsDetector::dumpDetectorSetup(string const fname, int level){ "trimbits",\ "extsig" }; - int nvar=40; + int nvar=41; int iv=0; string fname1; ofstream outfile; @@ -5497,7 +5498,7 @@ masterFlags slsDetector::setMaster(masterFlags flag) { } #ifdef VERBOSE - std::cout<< "Readout flag set to "<< retval << std::endl; + std::cout<< "Master flag set to "<< retval << std::endl; #endif return retval; } diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index ba992e032..a6f48060c 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -879,6 +879,7 @@ string slsDetectorCommand::cmdRemove(int narg, char *args[], int action){ return string("cannot get"); } + string slsDetectorCommand::helpRemove(int narg, char *args[], int action){ return string("remove det \t removes a detector. det can either be the detector hostname or the detector position. Returns the total number of detectors in the multidetector structure\n"); }