mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
added a testfunction to test start and stop acquisition of gotthard
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@130 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -5296,4 +5296,47 @@ int slsDetector::saveSettingsFile(string fname, int imod) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsDetector::testFunction(int times) {
|
||||||
|
int val = 0,i,oldval=0;
|
||||||
|
runStatus s;
|
||||||
|
|
||||||
|
|
||||||
|
for(i=0;i<times;i++){
|
||||||
|
std::cout<<std::endl<<dec<<i+1<<": \t";
|
||||||
|
usleep(2000000);
|
||||||
|
startAcquisition();
|
||||||
|
s = getRunStatus();
|
||||||
|
if(s==IDLE){
|
||||||
|
std::cout<<"NOTTT WORKED"<<std::endl;
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
else if (s==RUNNING){
|
||||||
|
while(s==RUNNING){
|
||||||
|
usleep(20);
|
||||||
|
val=readRegister(0x25);
|
||||||
|
if(val!=oldval)
|
||||||
|
std::cout<<hex<<val<<"\t";
|
||||||
|
if(val){
|
||||||
|
if((val&0x100)||(val&0x200)||(val&0x400))
|
||||||
|
s = getRunStatus();
|
||||||
|
else{
|
||||||
|
std::cout<<"\nStuck status.Exit\n";
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
oldval=val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
std::cout<<"\nWeird Status.Exit\n";
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::cout<<std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1453,6 +1453,10 @@ typedef struct sharedSlsDetector {
|
|||||||
char* setServerMAC(string serverMAC);
|
char* setServerMAC(string serverMAC);
|
||||||
|
|
||||||
|
|
||||||
|
/** temporary test fucntion */
|
||||||
|
int testFunction(int times=0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -350,6 +350,10 @@ slsDetectorCommand::slsDetectorCommand() {
|
|||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDigiTest;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDigiTest;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="acqtest"; //
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDigiTest;
|
||||||
|
i++;
|
||||||
|
|
||||||
descrToFuncMap[i].m_pFuncName="reg_rw"; //
|
descrToFuncMap[i].m_pFuncName="reg_rw"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdRegister;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdRegister;
|
||||||
i++;
|
i++;
|
||||||
@ -2543,9 +2547,23 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action) {
|
|||||||
else
|
else
|
||||||
return string("Use only 0 or 1 to set/clear digital test bit\n");
|
return string("Use only 0 or 1 to set/clear digital test bit\n");
|
||||||
} else
|
} else
|
||||||
return string("undefined value");
|
return string("undefined number");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd=="acqtest") {
|
||||||
|
if (action==GET_ACTION)
|
||||||
|
return string("cannot get ")+cmd;
|
||||||
|
int ival=-1;
|
||||||
|
if (sscanf(args[1],"%d",&ival)) {
|
||||||
|
if(ival<1)
|
||||||
|
return helpDigiTest(narg, args, action);
|
||||||
|
else {
|
||||||
|
sprintf(answer,"%x",testFunction(ival));
|
||||||
|
return string(answer);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
return string("undefined number");
|
||||||
|
}
|
||||||
|
|
||||||
return string("unknown digital test mode ")+cmd;
|
return string("unknown digital test mode ")+cmd;
|
||||||
|
|
||||||
@ -2558,6 +2576,10 @@ string slsDetectorCommand::helpDigiTest(int narg, char *args[], int action) {
|
|||||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||||
os << "digitaltest:i \n performs digital test of the module i. Returns 0 if succeeded, otherwise error mask."<< std::endl;
|
os << "digitaltest:i \n performs digital test of the module i. Returns 0 if succeeded, otherwise error mask."<< std::endl;
|
||||||
os << "bustest \n performs test of the bus interface between FPGA and embedded Linux system. Can last up to a few minutes."<< std::endl;
|
os << "bustest \n performs test of the bus interface between FPGA and embedded Linux system. Can last up to a few minutes."<< std::endl;
|
||||||
|
}
|
||||||
|
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||||
|
os << "digibittest i\n sets a variable in the server to be used in configuremac function. i sets/clears the digital test bit."<< std::endl;
|
||||||
|
os << "acqtest i\n runs start acquisition i number of times."<< std::endl;
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ class slsDetectorCommand;
|
|||||||
virtual int retrieveDetectorSetup(string const fname, int level=0)=0;
|
virtual int retrieveDetectorSetup(string const fname, int level=0)=0;
|
||||||
virtual int loadImageToDetector(int index,string const fname)=0;
|
virtual int loadImageToDetector(int index,string const fname)=0;
|
||||||
|
|
||||||
|
virtual int testFunction(int times=0)=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user