mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
modified configuremac function, moved digital test bit to digital test function
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@126 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
7ed37b2e3f
commit
8e79e5077f
@ -1571,21 +1571,19 @@ int slsDetector::digitalTest( digitalTestMode mode, int imod){
|
||||
int retval;
|
||||
int fnum=F_DIGITAL_TEST;
|
||||
int ret=FAIL;
|
||||
|
||||
char mess[100];
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< std::endl;
|
||||
std::cout<< "Getting id of "<< mode << std::endl;
|
||||
#endif
|
||||
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
|
||||
|
||||
if (controlSocket) {
|
||||
if (controlSocket->Connect()>=0) {
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&mode,sizeof(mode));
|
||||
if (mode==CHIP_TEST)
|
||||
if ((mode==CHIP_TEST)|| (mode==DIGITAL_BIT_TEST))
|
||||
controlSocket->SendDataOnly(&imod,sizeof(imod));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret!=FAIL)
|
||||
@ -4356,7 +4354,7 @@ char* slsDetector::setServerMAC(string serverMAC){
|
||||
};
|
||||
|
||||
|
||||
int slsDetector::configureMAC(int ival){
|
||||
int slsDetector::configureMAC(){
|
||||
int retval,i;
|
||||
int ret=FAIL;
|
||||
int fnum=F_CONFIGURE_MAC;
|
||||
@ -4414,7 +4412,6 @@ int slsDetector::configureMAC(int ival){
|
||||
if (controlSocket->Connect()>=0) {
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||
controlSocket->SendDataOnly(&ival,sizeof(ival));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret!=FAIL)
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
|
@ -336,9 +336,8 @@ typedef struct sharedSlsDetector {
|
||||
|
||||
/**
|
||||
configures mac for gotthard readout
|
||||
\param ival temporarily used to set/reset the digital test bit
|
||||
*/
|
||||
int configureMAC(int ival);
|
||||
int configureMAC();
|
||||
|
||||
/**
|
||||
Purely virtual function
|
||||
|
@ -346,6 +346,10 @@ slsDetectorCommand::slsDetectorCommand() {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDigiTest;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="digibittest"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDigiTest;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="reg_rw"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdRegister;
|
||||
i++;
|
||||
@ -2222,12 +2226,19 @@ string slsDetectorCommand::cmdConfigureMac(int narg, char *args[], int action) {
|
||||
int ival;
|
||||
int ret;
|
||||
char ans[1000];
|
||||
if (action==PUT_ACTION) {
|
||||
if (sscanf(args[1],"%d",&ival))
|
||||
ret=configureMAC(ival);
|
||||
else
|
||||
return string("Could not scan digital test bit ")+string(args[1]);
|
||||
|
||||
if (action==PUT_ACTION){
|
||||
if (sscanf(args[1],"%d",&ival))
|
||||
if(ival==1){
|
||||
setOnline(ONLINE_FLAG);
|
||||
ret=configureMAC();
|
||||
}
|
||||
else
|
||||
return string("Not yet implemented with arguments other than 1");
|
||||
}
|
||||
else
|
||||
return string("Cannot get ")+cmd;
|
||||
|
||||
sprintf(ans,"%d",ret);
|
||||
return ans;
|
||||
}
|
||||
@ -2235,13 +2246,12 @@ string slsDetectorCommand::cmdConfigureMac(int narg, char *args[], int action) {
|
||||
string slsDetectorCommand::helpConfigureMac(int narg, char *args[], int action) {
|
||||
|
||||
ostringstream os;
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "configuremac i \n configures the MAC of the detector and sets/resets (1/0) the digital test bit"<< std::endl;
|
||||
if (action==PUT_ACTION || action==HELP_ACTION)
|
||||
os << "configuremac i \n configures the MAC of the detector. i=1 for configure; i=0 for unconfigure(not implemented yet)"<< std::endl;
|
||||
if (action==GET_ACTION || action==HELP_ACTION)
|
||||
os << "configuremac " << "Cannot get " << std::endl;
|
||||
|
||||
}
|
||||
return os.str();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2497,31 +2507,46 @@ string slsDetectorCommand::cmdDigiTest(int narg, char *args[], int action) {
|
||||
|
||||
char answer[1000];
|
||||
|
||||
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot set");
|
||||
|
||||
|
||||
if (action==HELP_ACTION)
|
||||
return helpSN(narg, args, action);
|
||||
|
||||
return helpSN(narg, args, action);
|
||||
|
||||
|
||||
setOnline(ONLINE_FLAG);
|
||||
|
||||
if (cmd=="bustest"){
|
||||
sprintf(answer,"%x",digitalTest(DETECTOR_BUS_TEST));
|
||||
return string(answer);
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot set ")+cmd;
|
||||
sprintf(answer,"%x",digitalTest(DETECTOR_BUS_TEST));
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
if (cmd=="digitest") {
|
||||
int ival=-1;
|
||||
if (sscanf(args[0],"digitest:%d",&ival)) {
|
||||
sprintf(answer,"%x",digitalTest(CHIP_TEST, ival));
|
||||
return string(answer);
|
||||
} else
|
||||
return string("undefined module number");
|
||||
}
|
||||
|
||||
if (cmd=="digitest") {
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot set ")+cmd;
|
||||
int ival=-1;
|
||||
if (sscanf(args[0],"digitest:%d",&ival)) {
|
||||
sprintf(answer,"%x",digitalTest(CHIP_TEST, ival));
|
||||
return string(answer);
|
||||
} else
|
||||
return string("undefined module number");
|
||||
}
|
||||
|
||||
if (cmd=="digibittest") {
|
||||
if (action==GET_ACTION)
|
||||
return string("cannot get ")+cmd;
|
||||
int ival=-1;
|
||||
if (sscanf(args[1],"%d",&ival)) {
|
||||
if((ival==0)||(ival==1)){
|
||||
sprintf(answer,"%x",digitalTest(DIGITAL_BIT_TEST,ival));
|
||||
return string(answer);
|
||||
}
|
||||
else
|
||||
return string("Use only 0 or 1 to set/clear digital test bit\n");
|
||||
} else
|
||||
return string("undefined value");
|
||||
}
|
||||
|
||||
|
||||
return string("unknown digital test mode ")+cmd;
|
||||
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ class slsDetectorCommand;
|
||||
virtual int setPort(portType t, int i=-1)=0;
|
||||
virtual int lockServer(int i=-1)=0;
|
||||
virtual string getLastClientIP()=0;
|
||||
virtual int configureMAC(int)=0;
|
||||
virtual int configureMAC()=0;
|
||||
virtual int setNumberOfModules(int i=-1, dimension d=X)=0;
|
||||
virtual int getMaxNumberOfModules(dimension d=X)=0;
|
||||
virtual int setDynamicRange(int i=-1)=0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user