Works with firmware version 100527

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@18 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi 2010-05-26 09:04:14 +00:00
parent aeab347db6
commit 8a5bc0750d
14 changed files with 875 additions and 254 deletions

View File

@ -117,7 +117,7 @@ enum detectorType {
PILATUS, /**< pilatus */
EIGER, /**< eiger */
GOTTHARD, /**< gotthard */
PICASSO, /**< mythen */
PICASSO, /**< picasso */
AGIPD /**< agipd */
};
@ -267,7 +267,7 @@ enum detectorSettings{
\see ::sls_detector_channel
*/
enum channelRegisterBit {
TRIMBIT_OFF, /**< offset of trimbit value in the channel register */
TRIMBIT_OFF=0, /**< offset of trimbit value in the channel register */
COMPARATOR_ENABLE=0x100, /**< mask of the comparator enable bit */
ANALOG_SIGNAL_ENABLE=0x200, /**< mask of the analogue output enable bit */
CALIBRATION_ENABLE=0x300, /**< mask of the calibration input enable bit */
@ -307,6 +307,8 @@ enum timerIndex {
enum speedVariable {
CLOCK_DIVIDER, /**< readout clock divider */
WAIT_STATES, /**< wait states for bus read */
TOT_CLOCK_DIVIDER, /**< wait states for bus read */
TOT_DUTY_CYCLE, /**< wait states for bus read */
SET_SIGNAL_LENGTH /**< set/clear signal length */
};
@ -332,7 +334,9 @@ enum readOutFlags {
READ_HITS=0x2, /**< return only the number of the channel which counted ate least one */
ZERO_COMPRESSION=0x4,/**< returned data are 0-compressed */
PUMP_PROBE_MODE=0x8,/**<pump-probe mode */
BACKGROUND_CORRECTIONS=0x1000 /**<background corrections */
BACKGROUND_CORRECTIONS=0x1000, /**<background corrections */
TOT_MODE=0x2000,/**<pump-probe mode */
CONTINOUS_RO=0x4000/**<pump-probe mode */
};
/**
trimming modes

View File

@ -357,9 +357,10 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
if (var=="nmod") {
if (action==PUT_ACTION) {
sscanf(args[1],"%d",&ival);
setNumberOfModules(ival);
}
sprintf(answer,"%d",setNumberOfModules(GET_FLAG));
//setNumberOfModules(ival);
} else
ival=GET_FLAG;
sprintf(answer,"%d",setNumberOfModules(ival));
return string(answer);
} else if (var=="maxmod") {
if (action==PUT_ACTION) {
@ -370,7 +371,7 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
} else if (var.find("extsig")==0) {
istringstream vvstr(var.substr(7));
vvstr >> ival;
externalSignalFlag flag=GET_EXTERNAL_SIGNAL_FLAG;
externalSignalFlag flag=GET_EXTERNAL_SIGNAL_FLAG, ret;
if (action==PUT_ACTION) {
sval=string(args[1]);
#ifdef VERBOSE
@ -389,10 +390,11 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
else if (sval=="trigger_out_falling_edge") flag=TRIGGER_OUT_FALLING_EDGE;
else if (sval=="ro_trigger_out_rising_edge") flag=RO_TRIGGER_OUT_RISING_EDGE;
else if (sval=="ro_trigger_out_falling_edge") flag=RO_TRIGGER_OUT_FALLING_EDGE;
setExternalSignalFlags(flag,ival);
}
switch (setExternalSignalFlags( GET_EXTERNAL_SIGNAL_FLAG,ival)) {
ret= setExternalSignalFlags(flag,ival);
switch (ret) {
case SIGNAL_OFF:
return string( "off");
case GATE_IN_ACTIVE_HIGH:
@ -473,18 +475,19 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
sprintf(answer,"%x",digitalTest(DETECTOR_BUS_TEST));
return string(answer);
} else if (var=="settings") {
detectorSettings sett=GET_SETTINGS;
if (action==PUT_ACTION) {
sval=string(args[1]);
detectorSettings sett=GET_SETTINGS;
if (sval=="standard")
sett=STANDARD;
else if (sval=="fast")
sett=FAST;
else if (sval=="highgain")
sett=HIGHGAIN;
setSettings(sett);
//setSettings(sett);
}
switch (setSettings( GET_SETTINGS)) {
//switch (setSettings( GET_SETTINGS)) {
switch (setSettings(sett)) {
case STANDARD:
return string("standard");
case FAST:
@ -516,7 +519,6 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
sscanf(args[1],"%f",&fval);// in seconds!
setTimer(ACQUISITION_TIME,fval*1E+9);
}
sprintf(answer,"%f",(float)setTimer(ACQUISITION_TIME)*1E-9);
return string(answer);
} else if (var=="period") {
@ -578,10 +580,14 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
readOutFlags flag=GET_READOUT_FLAGS;
if (sval=="none")
flag=NORMAL_READOUT;
else if (sval=="pumpprobe")
flag=PUMP_PROBE_MODE;
//else if (sval=="pumpprobe")
// flag=PUMP_PROBE_MODE;
else if (sval=="storeinram")
flag=STORE_IN_RAM;
else if (sval=="tot")
flag=TOT_MODE;
else if (sval=="continous")
flag=CONTINOUS_RO;
setReadOutFlags(flag);
}
@ -591,6 +597,10 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
return string("none");
case STORE_IN_RAM:
return string("storeinram");
case TOT_MODE:
return string("tot");
case CONTINOUS_RO:
return string("continous");
default:
return string("unknown");
}
@ -694,6 +704,20 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
sprintf(answer,"%d", setSpeed(WAIT_STATES));
return string(answer);
} else if (var=="totdivider") {
if (action==PUT_ACTION) {
sscanf(args[1],"%d",&ival);
setSpeed(TOT_CLOCK_DIVIDER,ival);
}
sprintf(answer,"%d", setSpeed(TOT_CLOCK_DIVIDER));
return string(answer);
} else if (var=="totdutycycle") {
if (action==PUT_ACTION) {
sscanf(args[1],"%d",&ival);
setSpeed(TOT_DUTY_CYCLE,ival);
}
sprintf(answer,"%d", setSpeed(TOT_DUTY_CYCLE));
return string(answer);
}
return ("Unknown command");
@ -973,8 +997,8 @@ int mythenDetector::readConfigurationFile(string const fname){
string::size_type pos;
int iargval;
int interrupt=0;
char *args[2];
for (int ia=0; ia<2; ia++) {
char *args[100];
for (int ia=0; ia<100; ia++) {
args[ia]=new char[1000];
}
@ -1055,8 +1079,8 @@ int mythenDetector::writeConfigurationFile(string const fname){
int nvar=14;
ofstream outfile;
int iv=0;
char *args[2];
for (int ia=0; ia<2; ia++) {
char *args[100];
for (int ia=0; ia<100; ia++) {
args[ia]=new char[1000];
}
@ -1218,8 +1242,9 @@ int mythenDetector::retrieveDetectorSetup(string fname1, int level){
if (level==2) {
fname=fname1+string(".config");
readConfigurationFile(fname);
fname=fname+string(".det");
}
fname=fname1+string(".det");
} else
fname=fname1;
infile.open(fname.c_str(), ios_base::in);
if (infile.is_open()) {
while (infile.good() and interrupt==0) {
@ -1241,10 +1266,13 @@ int mythenDetector::retrieveDetectorSetup(string fname1, int level){
iargval=0;
while (ssstr.good()) {
ssstr >> sargname;
if (ssstr.good()) {
// if (ssstr.good()) {
strcpy(args[iargval],sargname.c_str());
#ifdef VERBOSE
std::cout<< args[iargval] << std::endl;
#endif
iargval++;
}
// }
}
if (level==2) {
executeLine(iargval,args,PUT_ACTION);
@ -1467,7 +1495,7 @@ int mythenDetector::writeTrimFile(string fname, sls_detector_module mod){
outfile.close();
return OK;
} else {
std::cout<< "could not open file " << fname << std::endl;
std::cout<< "could not open trim file " << fname << std::endl;
return FAIL;
}
@ -1492,16 +1520,14 @@ int mythenDetector::writeDataFile(string fname, float *data, float *err, float *
int idata;
if (data==NULL)
return FAIL;
#ifdef VERBOSE
std::cout<< "writing data to file " << fname << std::endl;
#endif
// args|=0x10; // one line per channel!
outfile.open (fname.c_str(),ios_base::out);
if (outfile.is_open())
{
#ifdef VERBOSE
std::cout<< "Writing to file " << fname << std::endl;
std::cout<< "writeDataFile Writing to file " << fname << std::endl;
#endif
for (int ichan=0; ichan<nch; ichan++) {
if (ang==NULL) {
@ -1975,6 +2001,10 @@ void mythenDetector::acquire(int delflag){
#endif
thisDetector->progressIndex=0;
resetFinalDataQueue();
resetDataQueue();
jointhread=0;
queuesize=0;
if (thisDetector->threadedProcessing) {
@ -2037,7 +2067,7 @@ void mythenDetector::acquire(int delflag){
} else if (ip<(np-1))
thisDetector->fileIndex=thisDetector->fileIndex-thisDetector->timerValue[FRAME_NUMBER];
#ifdef VERBOSE
cout << "Setting file index to " << thisDetector->fileIndex << endl;
cout << "------------------------------------------------------Setting file index to " << thisDetector->fileIndex << endl;
#endif
}
@ -2108,10 +2138,20 @@ void* mythenDetector::processData(int delflag) {
//delete [] myData;
// myData=NULL;
/** write raw data file */
if (thisDetector->correctionMask!=0 || delflag==0) {
if (thisDetector->correctionMask==0 && delflag==1) {
#ifdef ACQVERBOSE
std::cout<< "------------------------------------no processing "<< delflag <<std::endl;
#endif
#ifdef VERBOSE
cout << "********************** no processing: writing file " << createFileName().append(".raw") << endl;
#endif
writeDataFile (createFileName().append(".raw"), fdata, NULL, NULL, 'i');
delete [] fdata;
} else {
writeDataFile (createFileName().append(".raw"), fdata, NULL, NULL, 'i');
#ifdef VERBOSE
std::cout << "********************** if (thisDetector->correctionMask!=0 || delflag==0) { writing raw data file " << createFileName() <<" " << thisDetector->correctionMask<< " " << delflag << endl;
#endif
/** rate correction */
if (thisDetector->correctionMask&(1<<RATE_CORRECTION)) {
rcdata=new float[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods];
@ -2172,6 +2212,9 @@ void* mythenDetector::processData(int delflag) {
}
if (thisDetector->correctionMask!=0)
#ifdef VERBOSE
std::cout << "********************** writing dat data file if (thisDetector->correctionMask!=0) { " << createFileName() <<" " << thisDetector->correctionMask << endl;
#endif
writeDataFile (createFileName().append(".dat"), ffcdata, ffcerr,ang);
@ -2187,6 +2230,9 @@ void* mythenDetector::processData(int delflag) {
/** file writing */
currentPositionIndex++;
if (thisDetector->correctionMask!=0)
#ifdef VERBOSE
std::cout << "********************** writing dat data file if ((currentPositionIndex==thisDetector->numberOfPositions) || (currentPositionIndex==0))" << createFileName() << endl;
#endif
writeDataFile (createFileName().append(".dat"),mergingCounts, mergingErrors, mergingBins,'f',np);
if (delflag) {
delete [] mergingBins;
@ -2201,7 +2247,7 @@ void* mythenDetector::processData(int delflag) {
finalDataQueue.push(thisData);
#ifdef ACQVERBOSE
std::cout<< "------------------------------------pushing final data queue " << finalDataQueue.size() << std::endl;
std::cout<< "------------------------------------pushing final data queue " << finalDataQueue.size() << " " << createFileName() << std::endl;
#endif
}
}
@ -2214,8 +2260,12 @@ void* mythenDetector::processData(int delflag) {
delete [] ang;
//}
} else {
if (thisDetector->correctionMask!=0)
if (thisDetector->correctionMask!=0) {
writeDataFile (createFileName().append(".dat"), ffcdata, ffcerr);
#ifdef VERBOSE
std::cout << "********************** if (thisDetector->correctionMask!=0) writing dat data file " << createFileName() << endl;
#endif
}
if (delflag) {
if (ffcdata)
delete [] ffcdata;
@ -2224,25 +2274,17 @@ void* mythenDetector::processData(int delflag) {
if (ang)
delete [] ang;
} else {
if (thisDetector->correctionMask!=0)
if (thisDetector->correctionMask!=0) {
thisData=new detectorData(ffcdata,ffcerr,NULL,thisDetector->progressIndex+1,(createFileName().append(".dat")).c_str(),thisDetector->nChans*thisDetector->nChips*thisDetector->nMods);
else
thisData=new detectorData(ffcdata,ffcerr,NULL,thisDetector->progressIndex+1,(createFileName().append(".raw")).c_str(),thisDetector->nChans*thisDetector->nChips*thisDetector->nMods);
finalDataQueue.push(thisData);
#ifdef ACQVERBOSE
std::cout<< "------------------------------------pushing final data queue " << finalDataQueue.size() << std::endl;
#endif
}
}
} else {
#ifdef ACQVERBOSE
std::cout<< "------------------------------------no processing "<< delflag <<std::endl;
#endif
thisData=new detectorData(ffcdata,ffcerr,NULL,thisDetector->progressIndex+1,(createFileName().append(".raw")).c_str(),thisDetector->nChans*thisDetector->nChips*thisDetector->nMods);
}
finalDataQueue.push(thisData);
#ifdef VERBOSE
cout << "writing file " << createFileName().append(".raw") << endl;
std::cout<< "------------------------------------pushing final data queue with " << createFileName() << " " <<finalDataQueue.size() << std::endl;
#endif
writeDataFile (createFileName().append(".raw"), fdata, NULL, NULL, 'i');
delete [] fdata;
}
}
}
thisDetector->fileIndex++;
#ifdef VERBOSE
@ -2279,10 +2321,10 @@ void* mythenDetector::processData(int delflag) {
if (jointhread) {
#ifdef ACQVERBOSE
std::cout<< "acquisition finished " << dataQueue.size() << " empty " << !dataQueue.empty() << std::endl;
#ifdef VERBOSE
std::cout<< "acquisition finished " << dataQueue.size() << " empty " << !dataQueue.empty() << "final data queue size: " << finalDataQueue.size() <<std::endl;
#endif
if (dataQueue.size()==0)
break;
}
dum=0;
@ -2315,9 +2357,9 @@ void mythenDetector::startThread(int delflag) {
// param.sched_priority = 5;
// scheduling parameters of main thread
ret = pthread_setschedparam(pthread_self(), policy, &mparam);
#ifdef VERBOSE
printf("current priority is %d\n",param.sched_priority);
#endif
//#ifdef VERBOSE
// printf("current priority is %d\n",param.sched_priority);
//#endif
if (delflag)
ret = pthread_create(&dataProcessingThread, &tattr,startProcessData, (void*)this);
else

View File

@ -76,7 +76,7 @@ enum {GET_ACTION, PUT_ACTION, READOUT_ACTION};
*/
int dumpDetectorSetup(string const fname, int level=0);
/**
retrieves alld possible detector parameters from file calling executeLine
retrieves all possible detector parameters from file calling executeLine
\param fname file to be read
*/
int retrieveDetectorSetup(string const fname, int level=0);
@ -301,7 +301,7 @@ enum {GET_ACTION, PUT_ACTION, READOUT_ACTION};
\param delflag if 1 the data are deleted, else left there for further processing (or plotting?)
*/
void acquire(int delflag);
void acquire(int delflag=1);
/**
get current timer value on the stop socket

View File

@ -13,13 +13,13 @@ INSTMODE= 0777
SRCS= server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c trimming_funcs.c sharedmemory.c
OBJS= $(SRCS:%.c=%.o)
CFLAGS+= -Wall -DC_ONLY -DMCB_FUNCS
#-DVERBOSE
CFLAGS+= -Wall -DC_ONLY -DMCB_FUNCS -DVERBOSE
#-DVERYVERBOSE
#-Werror
LDLIBS+= -lm
mythen: $(PROGS)
all: $(PROGS)
boot: $(OBJS)
@ -28,12 +28,14 @@ $(PROGS): $(OBJS)
echo $(OBJS)
$(CC) $(LDFLAGS) $^ $(LDLIBS) $(CFLAGS) -o $@
install: $(PROGS)
$(INSTALL) -d $(INSTDIR)
$(INSTALL) -m $(INSTMODE) $(PROGS) $(INSTDIR)
clean:
rm -rf $(PROGS) *.o
rm -rf $(PROGS) $(PICASSO) *.o
depend:
makedepend -Y -- $(CFLAGS) -- $(SRCS) 2>/dev/null

View File

@ -1,5 +1,9 @@
#ifndef PICASSOD
#include "server_defs.h"
#else
#include "picasso_defs.h"
#endif
#include "firmware_funcs.h"
#include "mcb_funcs.h"
#include "registers.h"
@ -207,14 +211,28 @@ u_int32_t getTotClockDivider() {
}
u_int32_t setTotDutyCycle(int d) {
u_int32_t c;
c=bus_r(SPEED_REG);
bus_w(SPEED_REG,(d<<TOTCLK_DUTYCYCLE_OFFSET)|(c&~(TOTCLK_DUTYCYCLE_MASK)));
return ((bus_r(SPEED_REG)& TOTCLK_DUTYCYCLE_MASK)>>TOTCLK_DUTYCYCLE_OFFSET);
}
u_int32_t getTotDutyCycle() {
u_int32_t clk_div;
clk_div=((bus_r(SPEED_REG)&TOTCLK_DUTYCYCLE_MASK)>>TOTCLK_DUTYCYCLE_OFFSET);
return clk_div;
}
u_int32_t setExtSignal(int d, enum externalSignalFlag mode) {
int modes[]={-1,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;
c=bus_r(EXT_SIGNAL_REG);
if (mode<=RO_TRIGGER_OUT_FALLING_EDGE)
if (mode<=RO_TRIGGER_OUT_FALLING_EDGE && mode>=0)
bus_w(EXT_SIGNAL_REG,((modes[mode])<<off)|(c&~(SIGNAL_MASK<<off)));
@ -239,6 +257,70 @@ int getExtSignal(int d) {
}
int setConfigurationRegister(int d) {
#ifdef VERBOSE
printf("Setting configuration register to %x",d);
#endif
if (d>=0) {
bus_w(CONFIG_REG,d);
}
#ifdef VERBOSE
printf("configuration register is %x", bus_r(CONFIG_REG));
#endif
return bus_r(CONFIG_REG);
}
int setToT(int d) {
int ret=0;
int reg;
#ifdef VERBOSE
printf("Setting ToT to %d\n",d);
#endif
reg=bus_r(CONFIG_REG);
#ifdef VERBOSE
printf("Before: ToT is %x\n", reg);
#endif
if (d>0) {
bus_w(CONFIG_REG,reg|TOT_ENABLE_BIT);
} else if (d==0) {
bus_w(CONFIG_REG,reg&(~TOT_ENABLE_BIT));
}
reg=bus_r(CONFIG_REG);
#ifdef VERBOSE
printf("ToT is %x\n", reg);
#endif
if (reg&TOT_ENABLE_BIT)
return 1;
else
return 0;
}
int setContinousReadOut(int d) {
int ret=0;
int reg;
#ifdef VERBOSE
printf("Setting Continous readout to %d\n",d);
#endif
reg=bus_r(CONFIG_REG);
#ifdef VERBOSE
printf("Before: Continous readout is %x\n", reg);
#endif
if (d>0) {
bus_w(CONFIG_REG,reg|CONT_RO_ENABLE_BIT);
} else if (d==0) {
bus_w(CONFIG_REG,reg&(~CONT_RO_ENABLE_BIT));
}
reg=bus_r(CONFIG_REG);
#ifdef VERBOSE
printf("Continous readout is %x\n", reg);
#endif
if (reg&CONT_RO_ENABLE_BIT)
return 1;
else
return 0;
}
u_int64_t getMcsNumber() {
FILE *fp=NULL;
@ -353,29 +435,112 @@ int getNModBoard() {
int setNMod(int n) {
int fifo;
int ifsta, ifsto, ifste;
if (n>0 && n<=getNModBoard()) {
nModX=n;
dataBytes=nModX*nModY*NCHIP*NCHAN*dynamicRange/8;
allocateRAM();
// int ifsta, ifsto, ifste;
int imod;
int rval;
int reg;
int shiftfifo=SHIFTFIFO;
int ntot=getNModBoard();
switch (dynamicRange) {
case 16:
shiftfifo=SHIFTFIFO-1;
break;
case 8:
shiftfifo=SHIFTFIFO-2;
break;
case 4:
shiftfifo=SHIFTFIFO-3;
break;
case 1:
shiftfifo=SHIFTFIFO-5;
break;
default:
shiftfifo=SHIFTFIFO;
}
#ifdef VERBOSE
printf("SetNMod called arg %d -- dr %d shiftfifo %d\n",n,dynamicRange,shiftfifo);
#endif
if (n>0 && n<=ntot) {
nModX=n;
// dataBytes=nModX*nModY*NCHIP*NCHAN*dynamicRange/8;
//allocateRAM();
/* should enable all fifos*/
bus_w(FIFO_CNTRL_REG_OFF+(ALLFIFO<<SHIFTMOD), FIFO_RESET_BIT | FIFO_DISABLE_TOGGLE_BIT);
/* // bus_w(FIFO_CNTRL_REG_OFF+(ALLFIFO<<SHIFTFIFO), FIFO_RESET_BIT | FIFO_DISABLE_TOGGLE_BIT);
bus_w(FIFO_CNTRL_REG_OFF+(ALLFIFO<<shiftfifo), FIFO_RESET_BIT | FIFO_DISABLE_TOGGLE_BIT);
#ifdef VERBOSE
printf("a %08x r %08x\n",FIFO_CNTRL_REG_OFF+(ALLFIFO<<shiftfifo),FIFO_RESET_BIT | FIFO_DISABLE_TOGGLE_BIT);
for (ififo=0; ififo<ntot*NCHIP; ififo++) {
printf("%d %08x\n",ififo,bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo)));
}
#endif
ifste=dynamicRange/32;
ifsta=nModX*NCHIP*ifste;
ifsto=ntot*NCHIP*ifste;
*/
/*d isable the fifos relative to the unused modules */
ifste=NCHAN*dynamicRange/32;
ifsta=nModX*NCHIP*ifste;
ifsto=nModBoard*NCHIP*ifste;
for (ififo=ifsta; ififo<ifsto; ififo+=ifste) {
for (ififo=0; ififo<ntot*NCHIP; ififo++) {
//for (ififo=ifsta; ififo<ifsto; ififo+=ifste) {
//fifocntrl[ififo]=FIFO_DISABLE_TOGGLE_BIT;
bus_w(FIFO_CNTRL_REG_OFF+(ififo<<SHIFTMOD), FIFO_DISABLE_TOGGLE_BIT);
printf("Disabling fifo %d\n",ififo);
}
reg=bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo));
#ifdef VERBOSE
printf("Fifo %d is %x",ififo,reg);
#endif
if (ififo<n*NCHIP) {
if (reg&FIFO_DISABLED_BIT)
bus_w(FIFO_CNTRL_REG_OFF+(ififo<<shiftfifo), FIFO_DISABLE_TOGGLE_BIT);
} else {
if ((reg&FIFO_DISABLED_BIT)==0)
bus_w(FIFO_CNTRL_REG_OFF+(ififo<<shiftfifo), FIFO_DISABLE_TOGGLE_BIT);
}
#ifdef VERBOSE
printf(" done %x\n",bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo)));
#endif
}
}
// ifste=dynamicRange/32;
nModX=0;
for (imod=0; imod<ntot; imod++) {
rval=0;
for (ififo=imod*NCHIP; ififo<(imod+1)*NCHIP; ififo++) {//
//for (ififo=imod*NCHIP*ifste; ififo<(imod+1)*NCHIP*ifste; ififo+=ifste) {
if ((bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo))&FIFO_DISABLED_BIT)==0){
rval=1; // checks if at least one fifo of the module is enabled
#ifdef VERBOSE
printf("%x Fifo %d is enabled\n",(bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo))), ififo);
#endif
}
#ifdef VERBOSE
else printf("%x Fifo %d is disabled\n",(bus_r(FIFO_COUNTR_REG_OFF+(ififo<<shiftfifo))),ififo);
#endif
}
if (rval) {
nModX++;
#ifdef VERBOSE
printf("Module %d is enabled --total %d\n",imod,nModX );
#endif
}
#ifdef VERBOSE
else printf("Module %d is disabled --total %d\n",imod,nModX );
#endif
}
#ifdef VERBOSE
printf("There are %d modules enabled\n",nModX);
#endif
// dataBytes=nModX*nModY*NCHIP*NCHAN*dynamicRange/8;
// allocateRAM();
getDynamicRange();
return nModX;
}
@ -519,6 +684,32 @@ int64_t getProbes(){
}
int setDACRegister(int idac, int val, int imod) {
u_int32_t addr, reg, mask;
int off;
#ifdef VERBOSE
printf("Settings dac %d module %d register to %d\n",idac,imod,val);
#endif
if ((idac%2)==0) {
addr=MOD_DACS1_REG;
} else {
addr=MOD_DACS2_REG;
}
off=(idac%3)*10;
mask=~((0x3ff)<<off);
if (val>=0 && val<DAC_DR) {
reg=bus_r(addr+(imod<<SHIFTMOD));
reg&=mask;
reg|=(val<<off);
bus_w(addr+(imod<<SHIFTMOD),reg);
}
val=(bus_r(addr+(imod<<SHIFTMOD))>>off)&0x3ff;
#ifdef VERBOSE
printf("Dac %d module %d register is %d\n",idac,imod,val);
#endif
return val;
}
@ -625,9 +816,27 @@ u_int32_t getNBits()
u_int32_t fifoReadCounter(int fifonum)
{
int rval=0;
rval=bus_r(FIFO_COUNTR_REG_OFF+(fifonum<<SHIFTFIFO));
int shiftfifo;
switch (dynamicRange) {
case 16:
shiftfifo=SHIFTFIFO-1;
break;
case 8:
shiftfifo=SHIFTFIFO-2;
break;
case 4:
shiftfifo=SHIFTFIFO-3;
break;
case 1:
shiftfifo=SHIFTFIFO-5;
break;
default:
shiftfifo=SHIFTFIFO;
}
rval=bus_r(FIFO_COUNTR_REG_OFF+(fifonum<<shiftfifo));
#ifdef VERBOSE
printf("FIFO %d countains %x words\n",fifonum, rval);
printf("FIFO %d contains %x words\n",fifonum, rval);
#endif
return rval;
}
@ -656,17 +865,25 @@ u_int32_t* fifo_read_event()
#ifdef VIRTUAL
return NULL;
#endif
while (bus_r(LOOK_AT_ME_REG)==0) {
#ifdef VERYVERBOSE
printf("Waiting for data\n");
#endif
if (runBusy()==0) {
if (bus_r(LOOK_AT_ME_REG)==0) {
#ifdef VERYVERBOSE
printf("no frame found\n");
printf("before looping\n");
for (ichip=0; ichip<nModBoard*NCHIP; ichip++) {
fifoReadCounter(ichip);
}
#endif
while(bus_r(LOOK_AT_ME_REG)==0) {
//#ifdef VERYVERBOSE
printf("Waiting for data status %x\n",runState());
//#endif
if (runBusy()==0) {
if (bus_r(LOOK_AT_ME_REG)==0) {
#ifdef VERBOSE
printf("no frame found %x status %x\n", bus_r(LOOK_AT_ME_REG),runState());
#ifdef VERYVERBOSE
for (ichip=0; ichip<nModBoard*NCHIP; ichip++) {
fifoReadCounter(ichip);
}
#endif
#endif
return NULL;
} else {
@ -674,7 +891,7 @@ u_int32_t* fifo_read_event()
}
}
}
#ifdef VERYVERBOSE
#ifdef VERBOSE
printf("before readout\n");
for (ichip=0; ichip<nModBoard*NCHIP; ichip++) {
fifoReadCounter(ichip);
@ -694,7 +911,6 @@ u_int32_t* fifo_read_event()
now_ptr+=dataBytes;
}
return ram_values;
}
@ -711,6 +927,9 @@ u_int32_t* decode_data(int *datain)
int ibyte, ibit;
char iptr;
#ifdef VERBOSE
printf("Decoding data for DR %d\n",dynamicRange);
#endif
dataout=malloc(nChans*nChips*nModX*4);
ichan=0;
switch (dynamicRange) {
@ -761,12 +980,15 @@ u_int32_t* decode_data(int *datain)
int setDynamicRange(int dr) {
int ow;
int nm;
u_int32_t np=getProbes();
#ifdef VERYVERBOSE
printf("probes==%02x\n",np);
#endif
if (dr>0) {
if (dr<=1) {
nm=setNMod(-1);
if (dr==1) {
dynamicRange=1;
ow=5;
} else if (dr<=4) {
@ -785,7 +1007,7 @@ int setDynamicRange(int dr) {
setCSregister(ALLMOD);
initChipWithProbes(0, ow,np, ALLMOD);
putout("0000000000000000",ALLMOD);
setNMod(nm);
}

View File

@ -33,11 +33,16 @@ u_int32_t setWaitStates(int d);
u_int32_t getWaitStates();
u_int32_t setTotClockDivider(int d);
u_int32_t getTotClockDivider();
u_int32_t setTotClockDutyCycle(int d);
u_int32_t getTotClockDutyCycle();
u_int32_t setExtSignal(int d, enum externalSignalFlag mode);
int getExtSignal(int d);
int setConfigurationRegister(int d);
int setToT(int d);
int setContinousReadOut(int d);
int setDACRegister(int idac, int val, int imod);
u_int64_t getMcsNumber();

View File

@ -5,9 +5,13 @@
#include <string.h>
#include <unistd.h>
#include <math.h>
#include "registers.h"
#ifndef PICASSOD
#include "server_defs.h"
#else
#include "picasso_defs.h"
#endif
#include "firmware_funcs.h"
#include "mcb_funcs.h"
@ -48,7 +52,9 @@ int initDetector() {
int imod;
// sls_detector_module *myModule;
int n=getNModBoard();
#ifdef VERBOSE
printf("Board is for %d modules\n",n);
#endif
detectorModules=malloc(n*sizeof(sls_detector_module));
detectorChips=malloc(n*NCHIP*sizeof(int));
@ -92,10 +98,14 @@ int initDetector() {
putout("0000000000000000",ALLMOD);
/* initialize dynamic range etc. */
nModX=n;
dataBytes=nModX*NCHIP*NCHAN*4;
dynamicRange=32;
initChip(0, 1,ALLMOD);
dynamicRange=getDynamicRange();
nModX=setNMod(-1);
//dataBytes=nModX*NCHIP*NCHAN*4;
// dynamicRange=32;
// initChip(0, 0,ALLMOD);
//nModX=n;
//
// allocateRAM();
@ -419,6 +429,8 @@ int program_one_dac(int addr, int value, int imod) {
int im;
int idac;
int v=value;
int reg, mask;
// sls_detector_module *myMod;
control=9+addr;
@ -472,15 +484,109 @@ int program_one_dac(int addr, int value, int imod) {
//(detectorModules+imod)->dacs[idac]=v;
detectorDacs[idac+NDAC*imod]=v;
//#ifdef VERBOSE
#ifdef VERBOSE
printf("module=%d index=%d, val=%d addr=%x\n",imod, idac, v, detectorDacs+idac+NDAC*imod);
#endif
setDACRegister(idac,v,imod);
/*
reg=bus_r(MOD_DACS1_REG+(imod<<SHIFTMOD));
#ifdef VERBOSE
printf("DACS register 1 is %x\n",reg);
#endif
if ((idac%2)==0) {
#ifdef VERYVERBOSE
printf("DACS %d div2 should be 0 is %d\n",idac, idac%2);
#endif
mask=~((0x3ff)<<((idac%3)*10));
reg&=mask;
reg|=(v<<((idac%3)*10));
#ifdef VERYVERBOSE
printf("DACS %d div3 is %d\n",idac, idac%3);
#endif
bus_w(MOD_DACS1_REG+(imod<<SHIFTMOD), reg);
}
#ifdef VERBOSE
printf("after setting dac %d module %d -- %x -- %x\n",idac, imod, reg, bus_r(MOD_DACS1_REG+(imod<<SHIFTMOD)));
#endif
reg=bus_r(MOD_DACS2_REG+(imod<<SHIFTMOD));
#ifdef VERBOSE
printf("DACS register 2 is %x\n",reg);
#endif
if ((idac%2)==1) {
#ifdef VERYVERBOSE
printf("DACS %d div2 should be 1 is %d\n",idac, idac%2);
#endif
mask=~((0x3ff)<<((idac%3)*10));
reg&=mask;
reg|=(v<<((idac%3)*10));
#ifdef VERYVERBOSE
printf("DACS %d div3 is %d\n",idac, idac%3);
#endif
bus_w(MOD_DACS2_REG+(imod<<SHIFTMOD), reg);
}
#ifdef VERBOSE
printf("after setting dac %d module %d -- %x -- %x\n",idac, imod, reg, bus_r(MOD_DACS2_REG+(imod<<SHIFTMOD)));
#endif
*/
//#endif
} else if (imod==ALLMOD) {
for (im=0; im<getNModBoard(); im++) {
detectorDacs[idac+NDAC*im]=v;
//#ifdef VERBOSE
/*
#ifdef VERBOSE
printf("all: module=%d index=%d, val=%d addr=%x\n",im, idac, v,detectorDacs+idac+NDAC*im);
//#endif
#endif
// (detectorModules+im)->dacs[idac]=v;
reg=bus_r(MOD_DACS1_REG+(imod<<SHIFTMOD));
#ifdef VERBOSE
printf("DACS register 1 is %x\n",reg);
#endif
if ((idac%2)==0) {
#ifdef VERYVERBOSE
printf("DACS %d div2 should be 0 is %d\n",idac, idac%2);
#endif
mask=~((0x3ff)<<((idac%3)*10));
reg&=mask;
reg|=(v<<((idac%3)*10));
#ifdef VERYVERBOSE
printf("DACS %d div3 is %d\n",idac, idac%3);
#endif
bus_w(MOD_DACS1_REG+(imod<<SHIFTMOD), reg);
}
#ifdef VERBOSE
printf("after setting dac %d module %d -- %x -- %x\n",idac, im, reg, bus_r(MOD_DACS1_REG+(im<<SHIFTMOD)));
#endif
reg=bus_r(MOD_DACS2_REG+(im<<SHIFTMOD));
#ifdef VERBOSE
printf("DACS register 2 is %x\n",reg);
#endif
if ((idac%2)==1) {
#ifdef VERYVERBOSE
printf("DACS %d div2 should be 1 is %d\n",idac, idac%2);
#endif
mask=~((0x3ff)<<((idac%3)*10));
reg&=mask;
reg|=(v<<((idac%3)*10));
#ifdef VERYVERBOSE
printf("DACS %d div3 is %d\n",idac, idac%3);
#endif
bus_w(MOD_DACS2_REG+(im<<SHIFTMOD), reg);
}
#ifdef VERBOSE
printf("after setting dac %d module %d -- %x -- %x addr %d\n",idac, im, reg, bus_r(MOD_DACS2_REG+(im<<SHIFTMOD)));
#endif
*/
setDACRegister(idac,v,im);
}
}
}
@ -564,15 +670,32 @@ float initDACbyIndexDACU(int ind, int val, int imod) {
*/
//return val;
}
if (imod>=0 && imod<nModX)
return detectorDacs[ind+imod*NDAC];
if (imod>=0 && imod<nModX) {
// return detectorDacs[ind+imod*NDAC];
return setDACRegister(ind, -1, imod);
}
else {
//iv=detectorDacs[ind];
#ifdef VERBOSE
printf("mod 0 of %d dac %d val %d\n",nModX,ind,setDACRegister(ind, -1, 0));
#endif
for (im=1; im<nModX; im++) {
if (detectorDacs[ind+im*NDAC]!=detectorDacs[ind])
#ifdef VERBOSE
printf("mod %d dac %d val %d\n",im,ind,setDACRegister(ind, -1, im));
#endif
//if (detectorDacs[ind+im*NDAC]!=detectorDacs[ind]) {
if (setDACRegister(ind, -1, im)!=setDACRegister(ind, -1, 0)) {
#ifdef VERBOSE
printf("mod %d returning -1\n",im);
#endif
return -1;
}
return detectorDacs[ind];
}
#ifdef VERBOSE
printf("returning %d\n",setDACRegister(ind, -1, 0));
#endif
return setDACRegister(ind, -1, 0);
}
}
@ -609,13 +732,17 @@ int getThresholdEnergy() {
//myo=-1;
}
if (myg>0 && myo>0)
ethr=(myo-detectorDacs[VTHRESH+imod*NDAC])*1000/myg;
if (myg>0 && myo>0) {
//ethr=(myo-detectorDacs[VTHRESH+imod*NDAC])*1000/myg;
ethr=(myo-setDACRegister(VTHRESH,-1,imod))*1000/myg;
// else
// ethr=-1;
}
#ifdef VERBOSE
printf("module=%d gain=%f, offset=%f, dacu=%f\n",imod, myg, myo, detectorDacs[VTHRESH+imod*NDAC]);
//printf("module=%d gain=%f, offset=%f, dacu=%f\n",imod, myg, myo, detectorDacs[VTHRESH+imod*NDAC]);
printf("module=%d gain=%f, offset=%f, dacu=%f\n",imod, myg, myo,setDACRegister(VTHRESH,-1,imod));
printf("Threshold energy of module %d is %d eV\n", imod, ethr);
#endif
@ -688,13 +815,15 @@ int setThresholdEnergy(int ethr) {
float getDACbyIndexDACU(int ind, int imod) {
/*
if (detectorDacs) {
if (imod<getNModBoard())
if (ind<(detectorModules+imod)->ndac)
return (detectorDacs[ind+imod*NDAC]);
}
return FAIL;
*/
return setDACRegister(ind, -1, imod);
}
@ -782,10 +911,15 @@ int setSettings(int i) {
} //else {
imod=0;
/* check settings for module 0 */
isett=UNDEFINED;
isett=UNDEFINED;/*
irgpr=detectorDacs[4+imod*NDAC];
irgsh1=detectorDacs[imod*NDAC+RGSH1];
irgsh2=detectorDacs[imod*NDAC+RGSH2];
*/
irgpr=setDACRegister(4,-1,imod);
irgsh1=setDACRegister(RGSH1,-1,imod);
irgsh2=setDACRegister(RGSH2,-1,imod);
for (is=STANDARD; is<UNDEFINED; is++) {
if (irgpr==rgpr[is] && irgsh1==rgsh1[is] && irgsh2==rgsh2[is]) {
isett=is;
@ -796,14 +930,25 @@ int setSettings(int i) {
#endif
for (imod=1; imod<nModX; imod++) {
if (isett!=UNDEFINED) {
irgpr=setDACRegister(4,-1,imod);
irgsh1=setDACRegister(RGSH1,-1,imod);
irgsh2=setDACRegister(RGSH2,-1,imod);
/*
irgpr=detectorDacs[4+imod*NDAC];
irgsh1=detectorDacs[imod*NDAC+RGSH1];
irgsh2=detectorDacs[imod*NDAC+RGSH2];
*/
if (irgpr!=rgpr[isett] || irgsh1!=rgsh1[isett] || irgsh2!=rgsh2[isett]) {
isett=UNDEFINED;
#ifdef VERBOSE
printf("Settings of module %d are undefined\n",imod);
printf("%d %d %d \n", irgpr, irgsh1, irgsh2);
printf("dacs 1: %08x dacs2: %08x\n",bus_r(MOD_DACS1_REG+(imod<<SHIFTMOD)), bus_r(MOD_DACS2_REG+(imod<<SHIFTMOD)));
#endif
}
}
}
@ -827,12 +972,15 @@ int setSettings(int i) {
int initChannelbyNumber(sls_detector_channel myChan) {
int reg=myChan.reg;
int ft=reg & TRIM_DR;
int cae=(reg>>(NTRIMBITS+1))&1;
int ae=(reg>>(NTRIMBITS+2))&1;
int coe=(reg>>(NTRIMBITS+3))&1;
int ocoe=(reg>>(NTRIMBITS+4))&1;
int counts=(reg>>(NTRIMBITS+5));
int cae=(reg>>(NTRIMBITS))&1;
int ae=(reg>>(NTRIMBITS+1))&1;
int coe=(reg>>(NTRIMBITS+2))&1;
int ocoe=(reg>>(NTRIMBITS+3))&1;
int counts=(reg>>(NTRIMBITS+4));
#ifdef VERBOSE
printf("Initializing channel %d chip %d module %d reg %x\n",myChan.chan,myChan.chip,myChan.module, reg);
printf("trim %d, cae %d, ae %d, coe %d, ocoe %d, counts %d\n",ft, cae, ae, coe, ocoe, counts);
#endif
if (myChan.chip<0)
setCSregister(myChan.module);
@ -845,6 +993,13 @@ int initChannelbyNumber(sls_detector_channel myChan) {
selChannel(myChan.chan,myChan.module);
initChannel(ft,cae,ae, coe, ocoe, counts,myChan.module);
setDynamicRange(dynamicRange);
setCSregister(ALLMOD);
clearSSregister(ALLMOD);
putout("0000000000000000",ALLMOD);
return myChan.reg;
}
@ -941,6 +1096,7 @@ int initChannel(int ft,int cae, int ae, int coe, int ocoe, int counts, int imod)
detectorChans[im*NCHAN*NCHIP+ichip*NCHAN+ichan]= ft | (cae<<(NTRIMBITS+1)) | (ae<<(NTRIMBITS+2)) | (coe<<(NTRIMBITS+3)) | (ocoe<<(NTRIMBITS+4)) | (counts<<(NTRIMBITS+5));
#ifdef VERBOSE
//printf("imod=%d ichip=%d ichan=%d addr=%x reg=%x\n",im,ichip,ichan,detectorChans+im*NCHAN*NCHIP+ichip*NCHAN+ichan, detectorChans[im*NCHAN*NCHIP+ichip*NCHAN+ichan]);
// printf("imod=%d ichip=%d ichan=%d addr=%x reg=%x\n",im,ichip,ichan,detectorChans+im*NCHAN*NCHIP+ichip*NCHAN+ichan, detectorChans[im*NCHAN*NCHIP+ichip*NCHAN+ichan]);
#endif
}
}
@ -1307,13 +1463,13 @@ int initChipWithProbes(int obe, int ow,int nprobes, int imod){
omask=16;
break;
default:
omask=1;
omask=0;//1;
break;
}
regval=(omask<<OUTMUX_OFFSET)|(nprobes<<PROBES_OFFSET)|(obe<<OUTBUF_OFFSET);
#ifdef VERYVERBOSE
printf("shift in will be %08x\n",regval);
#ifdef VERBOSE
printf("initChip: shift in will be %08x\n",regval);
#endif
/* clearing shift in register */

View File

@ -56,6 +56,9 @@
#define GET_SHIFT_IN_REG 0x022000
#define MOD_DACS1_REG 0x030000
#define MOD_DACS2_REG 0x040000
#define MCB_CNTRL_REG_OFF 0x100000
#define MCB_DOUT_REG_OFF 0x200000
#define FIFO_CNTRL_REG_OFF 0x300000
@ -66,6 +69,7 @@
#define SHIFTFIFO 9
/* values defined for FPGA */
#define MCSNUM 0x0
#define MCSVERSION 0x101
@ -99,13 +103,17 @@
#define SOME_FIFO_FULL_BIT 0x00008000 // error!
#define ALL_FIFO_EMPTY_BIT 0x00010000 // data ready
/* for fifo status register */
#define FIFO_DISABLED_BIT 0x81000000
#define FIFO_ERROR_BIT 0x08000000
#define FIFO_EMPTY_BIT 0x04000000
#define FIFO_DATA_READY_BIT 0x02000000
#define FIFO_COUNTER_MASK 0x00ffffff
/* for config register */
#define TOT_ENABLE_BIT 0x00000002
#define TIMED_GATE_BIT 0x00000004
#define TIMED_GATE_BIT 0x00000004
#define CONT_RO_ENABLE_BIT 0x00080000
@ -120,7 +128,8 @@
#define WAIT_STATES_OFFSET 12
#define TOTCLK_DIVIDER_MASK 0xff000000
#define TOTCLK_DIVIDER_OFFSET 24
#define TOTCLK_DUTYCYCLE_MASK 0x00ff0000
#define TOTCLK_DUTYCYCLE_OFFSET 16
/* for external signal register */

View File

@ -34,19 +34,20 @@ int main(int argc, char *argv[])
b=0;
printf("opening stop server on port %d\n",portno);
}
#ifndef VIRTUAL
system("bus -a 0xb0000000 -w 0xd0008");
#endif
init_detector(b);
bindSocket(portno);
if (getServerError())
if (getServerError()) {
printf("server error!\n");
return -1;
}
/* assign function table */
function_table();
#ifdef VERBOSE
printf("function table assigned \n");
#endif
/* waits for connection */

View File

@ -38,5 +38,5 @@
#define CLK_FREQ 100E+6
#define THIS_SOFTWARE_VERSION 0x20090205
#define THIS_SOFTWARE_VERSION 0x20100429
#endif

View File

@ -1,6 +1,10 @@
#include "sls_detector_defs.h"
#include "server_funcs.h"
#ifndef PICASSOD
#include "server_defs.h"
#else
#include "picasso_defs.h"
#endif
#include "firmware_funcs.h"
#include "mcb_funcs.h"
#include "trimming_funcs.h"
@ -36,9 +40,18 @@ char mess[1000];
int init_detector( int b) {
#ifndef PICASSOD
printf("This is a MYTHEN detector with %d chips per module\n", NCHIP);
#else
printf("This is a PICASSO detector with %d chips per module\n", NCHIP);
#endif
mapCSP0();
#ifndef VIRTUAL
system("bus -a 0xb0000000 -w 0xd0008");
#ifdef VERBOSE
printf("setting wait states \n");
system("bus -a 0xb0000000");
#endif
#endif
testFpga();
#ifdef MCB_FUNCS
@ -133,7 +146,7 @@ int M_nofunc(int fnum){
sprintf(mess,"Unrecognized Function %d\n",fnum);
printf(mess);
sendDataOnly(&retval,sizeof(retval));
sendDataOnly(mess,strlen(mess)+1);
sendDataOnly(mess,sizeof(mess));
return -1;
}
@ -143,7 +156,7 @@ int exit_server(int fnum) {
sendDataOnly(&retval,sizeof(retval));
printf("closing server.");
sprintf(mess,"closing server");
sendDataOnly(mess,strlen(mess)+1);
sendDataOnly(mess,sizeof(mess));
return GOODBYE;
}
@ -216,7 +229,7 @@ int get_detector_type(int fnum) {
/* send return argument */
n += sendDataOnly(&ret,sizeof(ret));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
/*return ok/fail*/
return retval;
@ -247,23 +260,27 @@ int set_number_of_modules(int fnum) {
#ifdef VERBOSE
printf("Setting the number of modules in dimension %d to %d\n",dim,nm );
#endif
if (nm!=GET_FLAG) {
//if (nm!=GET_FLAG) {
if (dim!=X) {
retval=FAIL;
sprintf(mess,"Can't change module number in dimension %d\n",dim);
} else {
setNMod(nm);
if (nModX==nm)
ret=setNMod(nm);
if (nModX==nm || nm==GET_FLAG)
retval=OK;
else
retval=FAIL;
}
}
}
if (dim==X)
ret=nModX;
else if (dim==Y)
/*} else {
if (dim==Y) {
ret=nModY;
} else if (dim==X) {
ret=setNMod(-1);
}
}
*/
/* send answer */
/* send OK/failed */
@ -272,7 +289,7 @@ int set_number_of_modules(int fnum) {
/* send return argument */
n += sendDataOnly(&ret,sizeof(ret));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
/*return ok/fail*/
return retval;
@ -324,7 +341,7 @@ int get_max_number_of_modules(int fnum) {
/* send return argument */
n += sendDataOnly(&ret,sizeof(ret));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
@ -386,7 +403,7 @@ int set_external_signal_flag(int fnum) {
/* send return argument */
n += sendDataOnly(&retval,sizeof(retval));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
@ -447,7 +464,7 @@ enum externalCommunicationMode{
/* send return argument */
n += sendDataOnly(&ret,sizeof(ret));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
/*return ok/fail*/
@ -530,7 +547,7 @@ int get_id(int fnum) {
/* send return argument */
n += sendDataOnly(&retval,sizeof(retval));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
/*return ok/fail*/
@ -620,7 +637,7 @@ int digital_test(int fnum) {
/* send return argument */
n += sendDataOnly(&retval,sizeof(retval));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
/*return ok/fail*/
@ -672,7 +689,7 @@ int write_register(int fnum) {
/* send return argument */
n += sendDataOnly(&retval,sizeof(retval));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
/*return ok/fail*/
@ -723,7 +740,7 @@ int read_register(int fnum) {
/* send return argument */
n += sendDataOnly(&retval,sizeof(retval));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
/*return ok/fail*/
@ -817,7 +834,7 @@ int set_dac(int fnum) {
/* send return argument */
n += sendDataOnly(&retval,sizeof(retval));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
/* Maybe this is done inside the initialization funcs */
@ -903,7 +920,7 @@ int get_adc(int fnum) {
/* send return argument */
n += sendDataOnly(&retval,sizeof(retval));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
/*return ok/fail*/
@ -961,7 +978,7 @@ int set_channel(int fnum) {
/* send return argument */
n += sendDataOnly(&retval,sizeof(retval));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
@ -1032,7 +1049,7 @@ int get_channel(int fnum) {
/* send return argument */
ret=sendChannel(&retval);
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
@ -1095,7 +1112,7 @@ int set_chip(int fnum) {
/* send return argument */
n += sendDataOnly(&retval,sizeof(retval));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
@ -1153,7 +1170,7 @@ int get_chip(int fnum) {
/* send return argument */
ret=sendChip(&retval);
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
@ -1247,7 +1264,7 @@ int set_module(int fnum) {
/* send return argument */
n += sendDataOnly(&retval,sizeof(retval));
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
free(myChip);
free(myChan);
@ -1344,7 +1361,7 @@ int get_module(int fnum) {
/* send return argument */
ret=sendModule(&myModule);
} else {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
@ -1396,7 +1413,7 @@ int get_threshold_energy(int fnum) {
/* send answer */
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
} else
n += sendDataOnly(&retval,sizeof(retval));
@ -1450,7 +1467,7 @@ int set_threshold_energy(int fnum) {
/* send answer */
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
} else
n += sendDataOnly(&retval,sizeof(retval));
@ -1502,7 +1519,7 @@ int set_settings(int fnum) {
/* send answer */
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
} else
n += sendDataOnly(&retval,sizeof(retval));
@ -1531,7 +1548,7 @@ int start_acquisition(int fnum) {
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
return ret;
@ -1555,7 +1572,7 @@ int stop_acquisition(int fnum) {
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
return ret;
@ -1580,7 +1597,7 @@ int start_readout(int fnum) {
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
}
return ret;
@ -1625,7 +1642,7 @@ int get_run_status(int fnum) {
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
} else {
n += sendDataOnly(&s,sizeof(s));
}
@ -1667,10 +1684,10 @@ int read_frame(int fnum) {
printf("%s\n",mess);
}
#ifdef VERYVERBOSE
printf("%d %d %x %s\n",strlen(mess)+1,strlen(mess), mess,mess);
printf("%d %d %x %s\n",sizeof(mess),strlen(mess), mess,mess);
#endif
sendDataOnly(&dataret,sizeof(dataret));
sendDataOnly(mess,strlen(mess)+1);//sizeof(mess));
sendDataOnly(mess,sizeof(mess));//sizeof(mess));//sizeof(mess));
#ifdef VERYVERBOSE
printf("message sent\n",mess);
#endif
@ -1707,7 +1724,7 @@ int read_frame(int fnum) {
printf("Frames left %d\n",getFrames());
#endif
sendDataOnly(&dataret,sizeof(dataret));
sendDataOnly(mess,strlen(mess)+1);
sendDataOnly(mess,sizeof(mess));
return dataret;
}
@ -1750,7 +1767,7 @@ int start_and_read_all(int fnum) {
if (ret!=OK) {
sprintf(mess,"could not start state machine\n");
sendDataOnly(&ret,sizeof(ret));
sendDataOnly(mess,strlen(mess)+1);
sendDataOnly(mess,sizeof(mess));
#ifdef VERBOSE
printf("could not start state machine\n");
@ -1848,7 +1865,7 @@ int set_timer(int fnum) {
printf("returning error\n");
#endif
n = sendDataOnly(mess,strlen(mess)+1);
n = sendDataOnly(mess,sizeof(mess));
} else {
#ifdef VERBOSE
printf("returning ok %d\n",sizeof(retval));
@ -1924,7 +1941,7 @@ int get_time_left(int fnum) {
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n += sendDataOnly(mess,strlen(mess)+1);
n += sendDataOnly(mess,sizeof(mess));
} else {
n = sendDataOnly(&retval,sizeof(retval));
}
@ -1999,7 +2016,7 @@ int set_dynamic_range(int fnum) {
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n = sendDataOnly(mess,strlen(mess)+1);
n = sendDataOnly(mess,sizeof(mess));
} else {
n = sendDataOnly(&retval,sizeof(retval));
}
@ -2045,30 +2062,42 @@ int set_speed(int fnum) {
if (ret==OK) {
switch (arg) {
case CLOCK_DIVIDER:
if (val>0)
if (val>=0)
retval=setClockDivider(val);
else
retval=getClockDivider();
break;
case WAIT_STATES:
if (val>0)
if (val>=0)
retval=setWaitStates(val);
else
retval=getWaitStates();
break;
case SET_SIGNAL_LENGTH:
if (val>0)
if (val>=0)
retval=setSetLength(val);
else
retval=getSetLength();
break;
case TOT_CLOCK_DIVIDER:
if (val>=0)
retval=setTotClockDivider(val);
else
retval=getTotClockDivider();
break;
case TOT_DUTY_CYCLE:
if (val>=0)
retval=setTotDutyCycle(val);
else
retval=getTotDutyCycle();
break;
default:
ret=FAIL;
}
}
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n = sendDataOnly(mess,strlen(mess)+1);
n = sendDataOnly(mess,sizeof(mess));
} else {
n = sendDataOnly(&retval,sizeof(retval));
}
@ -2083,6 +2112,7 @@ int set_readout_flags(int fnum) {
enum readOutFlags arg;
int n;
int ret=OK;
int regret=OK;
sprintf(mess,"can't set readout flags\n");
@ -2105,30 +2135,50 @@ int set_readout_flags(int fnum) {
case GET_READOUT_FLAGS:
break;
case STORE_IN_RAM:
ret=setStoreInRAM(1);
if (setStoreInRAM(1)==OK)
ret=OK;
else
ret=FAIL;
break;
case PUMP_PROBE_MODE:
case TOT_MODE:
if(setToT(1))
ret=OK;
else
ret=FAIL;
break;
case CONTINOUS_RO:
if (setContinousReadOut(1))
ret=OK;
else
ret=FAIL;
break;
// case PUMP_PROBE_MODE:
//set number of probes
initChipWithProbes(0,0,2, ALLMOD);
break;
//initChipWithProbes(0,0,2, ALLMOD);
//break;
default:
ret=setStoreInRAM(0);
regret=setConfigurationRegister(0);
ret=OK;
}
if (storeInRAM)
retval=STORE_IN_RAM;
else if (getProbes())
retval=PUMP_PROBE_MODE;
else
retval=NORMAL_READOUT;
if (storeInRAM)
retval=STORE_IN_RAM;
//else if (getProbes())
// retval=PUMP_PROBE_MODE;
//else
if (setToT(-1))
retval|=TOT_MODE;
if (setContinousReadOut(-1))
retval|=CONTINOUS_RO;
if (ret!=OK) {
printf("set readout flags failed\n");
sprintf(mess,"Could not allocate RAM\n");
}
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n = sendDataOnly(mess,strlen(mess)+1);
n = sendDataOnly(mess,sizeof(mess));
} else {
n = sendDataOnly(&retval,sizeof(retval));
}
@ -2211,7 +2261,7 @@ int execute_trimming(int fnum) {
}
n = sendDataOnly(&ret,sizeof(ret));
if (ret!=OK) {
n = sendDataOnly(mess,strlen(mess)+1);
n = sendDataOnly(mess,sizeof(mess));
}
return ret;

View File

@ -1,5 +1,8 @@
#ifndef PICASSOD
#include "server_defs.h"
#else
#include "picasso_defs.h"
#endif
#include "trimming_funcs.h"
#include "mcb_funcs.h"
#include "firmware_funcs.h"
@ -156,6 +159,8 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
int modma, modmi, nm;
int thr, thrstep=5, nthr=31;
int *fifodata;
float vthreshmean, vthreshSTDev;
int *thrmi, *thrma;
float c;
@ -166,6 +171,8 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
int nvalid=0;
u_int32_t *scan;
int ithr;
sls_detector_channel myChan;
setFrames(1);
@ -195,7 +202,11 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
clearSSregister(im);
usleep(500);
*/
myChan.chan=-1;
myChan.chip=-1;
myChan.module=ALLMOD;
myChan.reg=COMPARATOR_ENABLE;
initChannelbyNumber(myChan);
for (ithr=0; ithr<nthr; ithr++) {
@ -209,9 +220,15 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
} else
initDACbyIndexDACU(VTHRESH,thr+thrstep,imod);
}
setCSregister(ALLMOD);
/* setCSregister(ALLMOD);
setSSregister(ALLMOD);
initChannel(0,0,0,1,0,0,im);
setDynamicRange(32);
*/
counterClear(ALLMOD);
clearSSregister(ALLMOD);
usleep(500);
@ -219,7 +236,8 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
while (runBusy()) {
}
usleep(500);
scan=decode_data(fifo_read_event());
fifodata=fifo_read_event();
scan=decode_data(fifodata);
for (imod=modmi; imod<modma; imod++) {
for (ichan=0; ichan<nChans*nChips; ichan++){
ich=imod*nChips*nChans+ichan;
@ -311,6 +329,10 @@ int trim_with_level(int countlim, int im) {
int *inttrim;
int modma, modmi, nm;
int retval=OK;
int *fifodata;
sls_detector_channel myChan;
printf("trimming module number %d", im);
#ifdef MCB_FUNCS
setFrames(1);
@ -332,10 +354,19 @@ int trim_with_level(int countlim, int im) {
for (itrim=0; itrim<TRIM_DR+1; itrim++) {
fifoReset();
printf("Trimbit %d\n",itrim);
myChan.chan=-1;
myChan.chip=-1;
myChan.module=ALLMOD;
myChan.reg=COMPARATOR_ENABLE|(itrim<<TRIMBIT_OFF);
initChannelbyNumber(myChan);
/*
setCSregister(im);
setSSregister(im);
printf("Trimbit %d\n",itrim);
initChannel(itrim,0,0,1,0,0,im);
initChannel(itrim,0,0,1,0,0,ALLMOD);
setDynamicRange(32);
*/
setCSregister(ALLMOD);
setSSregister(ALLMOD);
counterClear(ALLMOD);
@ -346,19 +377,21 @@ int trim_with_level(int countlim, int im) {
}
usleep(500);
scan=decode_data(fifo_read_event());
fifodata=fifo_read_event();
scan=decode_data(fifodata);
for (imod=modmi; imod<modma; imod++) {
for (ichan=0; ichan<nChans*nChips; ichan++) {
ich=ichan+imod*nChans*nChips;
if (inttrim[ich]==-1) {
if (scan[ich]>countlim){
inttrim[ich]=itrim;
if (scan[ich]>2*countlim || itrim==0) {
#ifdef VERBOSE
printf("Channel %d trimbit %d counted %d countlim %d\n",ich,itrim,scan[ich],countlim);
#endif
if (scan[ich]>2*countlim && itrim>0) {
//if (scan[ich]>2*countlim || itrim==0) {
inttrim[ich]=itrim-1;
}
#ifdef VERBOSE
printf("Channel %d trimbit %d counted %d (%08x) countlim %d\n",ich,itrim,scan[ich],fifodata[ich],countlim);
#endif
}
}
#ifdef VERBOSE
@ -380,12 +413,12 @@ int trim_with_level(int countlim, int im) {
ich=ichan+imod*nChans*nChips+ichip*nChans;
if (*(inttrim+ich)==-1) {
*(inttrim+ich)=TRIM_DR;
printf("could not trim channel %d chip %d module %d - set to %d\n", ichan, ichip, imod, *(inttrim+ich) );
// printf("could not trim channel %d chip %d module %d - set to %d\n", ichan, ichip, imod, *(inttrim+ich) );
retval=FAIL;
}
#ifdef VERBOSE
else
printf("channel %d trimbit %d\n",ich,*(inttrim+ich) );
// else
// printf("channel %d trimbit %d\n",ich,*(inttrim+ich) );
#endif
initChannel(inttrim[ich],0,0,1,0,0,imod);
}
@ -453,7 +486,7 @@ int choose_vthresh() {
int vthresh;
int im=ALLMOD;
int modma, modmi, nm;
int *fifodata;
setFrames(1);
// setNMod(getNModBoard());
@ -469,6 +502,8 @@ int choose_vthresh() {
setDynamicRange(32);
setCSregister(ALLMOD);
setSSregister(ALLMOD);
counterClear(ALLMOD);
@ -480,7 +515,8 @@ int choose_vthresh() {
}
usleep(500);
scan=decode_data(fifo_read_event());
fifodata=fifo_read_event();
scan=decode_data(fifodata);
for (imod=modmi; imod<modma; imod++) {
@ -498,6 +534,7 @@ int choose_vthresh() {
free(scan);
while(change_flag && iteration<maxiterations) {
setDynamicRange(32);
fifoReset();
setCSregister(ALLMOD);
setSSregister(ALLMOD);
@ -508,7 +545,9 @@ int choose_vthresh() {
while (runBusy()) {
}
usleep(500);
scan=decode_data(fifo_read_event());
fifodata=fifo_read_event();
scan=decode_data(fifodata);
change_flag=0;
printf("Vthresh iteration %3d 0f %3d\n",iteration, maxiterations);
@ -571,6 +610,7 @@ int trim_with_median(int stop, int im) {
int me[nModX];
int modma, modmi, nm;
int trim;
int *fifodata;
setFrames(1);
// setNMod(getNModBoard());
@ -617,6 +657,7 @@ int trim_with_median(int stop, int im) {
**************/
while(change_flag && iteration<stop) {
setDynamicRange(32);
fifoReset();
setCSregister(ALLMOD);
setSSregister(ALLMOD);
@ -627,7 +668,9 @@ int trim_with_median(int stop, int im) {
while (runBusy()) {
}
usleep(500);
scan=decode_data(fifo_read_event());
fifodata=fifo_read_event();
scan=decode_data(fifodata);
/********* calculates median every time ***********/

View File

@ -1409,11 +1409,11 @@ int slsDetector::setChannel(int64_t reg, int ichan, int ichip, int imod){
#ifdef VERBOSE
std::cout<< "Setting channel "<< ichan << " " << ichip << " " << imod << " to " << reg << std::endl;
#endif
int mmin=imod, mmax=imod+1, chimin=ichip, chimax=ichip+1, chamin=ichan, chamax=ichan+1;
//int mmin=imod, mmax=imod+1, chimin=ichip, chimax=ichip+1, chamin=ichan, chamax=ichan+1;
int ret;
if (imod==-1) {
/* if (imod==-1) {
mmin=0;
mmax=thisDetector->nModsMax;
}
@ -1426,19 +1426,19 @@ int slsDetector::setChannel(int64_t reg, int ichan, int ichip, int imod){
if (ichan==-1) {
chamin=0;
chamax=thisDetector->nChans;
}
}*/
for (int im=mmin; im<mmax; im++) {
for (int ichi=chimin; ichi<chimax; ichi++) {
for (int icha=chamin; icha<chamax; icha++) {
myChan.chan=icha;
myChan.chip=ichi;
myChan.module=im;
// for (int im=mmin; im<mmax; im++) {
// for (int ichi=chimin; ichi<chimax; ichi++) {
// for (int icha=chamin; icha<chamax; icha++) {
myChan.chan=ichan;//icha;
myChan.chip=ichip;//ichi;
myChan.module=imod;//im;
myChan.reg=reg;
ret=setChannel(myChan);
}
}
}
// }
// }
// }
return ret;
}
@ -1450,9 +1450,9 @@ int slsDetector::setChannel(sls_detector_channel chan){
int ret=FAIL;
char mess[100];
int icha=chan.chan;
int ichi=chan.chip;
int im=chan.module;
int ichan=chan.chan;
int ichip=chan.chip;
int imod=chan.module;
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (controlSocket) {
@ -1475,7 +1475,39 @@ int slsDetector::setChannel(sls_detector_channel chan){
if (ret==OK) {
if (chanregs) {
int mmin=imod, mmax=imod+1, chimin=ichip, chimax=ichip+1, chamin=ichan, chamax=ichan+1;
if (imod==-1) {
mmin=0;
mmax=thisDetector->nModsMax;
}
if (ichip==-1) {
chimin=0;
chimax=thisDetector->nChips;
}
if (ichan==-1) {
chamin=0;
chamax=thisDetector->nChans;
}
for (int im=mmin; im<mmax; im++) {
for (int ichi=chimin; ichi<chimax; ichi++) {
for (int icha=chamin; icha<chamax; icha++) {
*(chanregs+im*thisDetector->nChans*thisDetector->nChips+ichi*thisDetector->nChips+icha)=retval;
}
}
}
}
}
#ifdef VERBOSE
@ -2122,15 +2154,26 @@ int slsDetector::setThresholdEnergy(int e_eV, int imod, detectorSettings isetti
oscfn << thisDetector->calDir << ssettings << "/calibration.sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im) << setbase(10);
//
trimfname=ostfn.str();
#ifdef VERBOSE
cout << trimfname << endl;
#endif
if (readTrimFile(trimfname,myMod)) {
calfname=oscfn.str();
#ifdef VERBOSE
cout << calfname << endl;
#endif
readCalibrationFile(calfname,myMod->gain, myMod->offset);
setModule(*myMod);
} else {
ostringstream ostfn,oscfn;
ostfn << thisDetector->trimDir << ssettings << ssettings << ".trim";
oscfn << thisDetector->calDir << ssettings << ssettings << ".cal";
calfname=oscfn.str();
trimfname=ostfn.str();
#ifdef VERBOSE
cout << trimfname << endl;
cout << calfname << endl;
#endif
if (readTrimFile(trimfname,myMod)) {
calfname=oscfn.str();
readCalibrationFile(calfname,myMod->gain, myMod->offset);
@ -2468,6 +2511,26 @@ detectorData* slsDetector::popFinalDataQueue() {
return retval;
}
void slsDetector::resetDataQueue() {
int *retval=NULL;
while( !dataQueue.empty() ) {
retval=dataQueue.front();
dataQueue.pop();
delete [] retval;
}
}
void slsDetector::resetFinalDataQueue() {
detectorData *retval=NULL;
while( !finalDataQueue.empty() ) {
retval=finalDataQueue.front();
finalDataQueue.pop();
delete retval;
}
}
/*
set or read the acquisition timers
enum timerIndex {

View File

@ -946,6 +946,30 @@ typedef struct sharedSlsDetector {
\sa finalDataQueue
*/
detectorData* popFinalDataQueue();
/**
resets the raw data queue
\sa dataQueue
*/
void resetDataQueue();
/**
resets the postprocessed data queue
\sa finalDataQueue
*/
void resetFinalDataQueue();
/**
set/get timer value
\param index timer index