getdata from commandline was getting stuck:fixed,eiger server remembers frame and exptime period cuz getstatus doesn work for now, request images, added setting image number in eigerserver, packetsize fixed in eigerserver

This commit is contained in:
Maliakal Dhanya 2014-06-16 17:00:21 +02:00
parent 73ba765647
commit cf52d85f73
8 changed files with 67 additions and 18 deletions

View File

@ -377,7 +377,7 @@ bool Beb::SendMultiReadRequest(unsigned int beb_number, unsigned int left_right,
else if(left_right == 3) send_data[0] = 0x000c0000;
else return 0;
packet_size/=2;
//packet_size/=2;
if(dst_number>0x3f) return 0;
if(packet_size>0x3ff) return 0;
if(npackets==0||npackets>0x100) return 0;

View File

@ -123,7 +123,13 @@ int EigerSetupTableEntryLeft(int ipad, long long int macad, long long int detect
(unsigned int)((macad>>8)&0xFF),
(unsigned int)((macad>>0)&0xFF));
/*
if(((detectormacadd>>40)&0xFF)<9)
sprintf(src_mac,"0%s",detectormacadd);
if(((macad>>40)&0xFF)<9)
sprintf(dst_mac,"0%s",macad);
*/
strcpy(src_mac,"00:aa:bb:cc:dd:ee");
printf("Seting up Table Entry Left:\n");
printf("src_port:%d\n",src_port);
printf("dst_port:%d\n",dst_port);
@ -132,8 +138,10 @@ int EigerSetupTableEntryLeft(int ipad, long long int macad, long long int detect
printf("src_mac:%s\n",src_mac);
printf("dst_mac:%s\n\n",dst_mac);
eiger_back_ret_val=0;
eiger_back_message_length = sprintf(eiger_back_message,"setuptableentry %d %d %d %s %s %d %s %s %d",1,0,0,src_mac,src_ip,src_port,dst_mac,dst_ip,dst_port);
eiger_back_message_length = sprintf(eiger_back_message,"setuptableentry %d %d %d %s %s %d %s %s %d",34,0,0,src_mac,src_ip,src_port,dst_mac,dst_ip,dst_port);
return EigerBackSendCMD();
}
@ -158,7 +166,7 @@ int EigerSetupTableEntryRight(int ipad, long long int macad, long long int detec
(unsigned int)((macad>>8)&0xFF),
(unsigned int)((macad>>0)&0xFF));
strcpy(src_mac,"00:aa:bb:cc:dd:ee");
printf("Seting up Table Entry Right:\n");
printf("src_port:%d\n",src_port);
printf("dst_port:%d\n",dst_port);
@ -168,7 +176,7 @@ int EigerSetupTableEntryRight(int ipad, long long int macad, long long int detec
printf("dst_mac:%s\n\n",dst_mac);
eiger_back_ret_val=0;
eiger_back_message_length = sprintf(eiger_back_message,"setuptableentry %d %d %d %s %s %d %s %s %d",1,0,32,src_mac,src_ip,src_port,dst_mac,dst_ip,dst_port);
eiger_back_message_length = sprintf(eiger_back_message,"setuptableentry %d %d %d %s %s %d %s %s %d",34,0,32,src_mac,src_ip,src_port,dst_mac,dst_ip,dst_port);
return EigerBackSendCMD();
}
@ -176,10 +184,25 @@ int EigerSetupTableEntryRight(int ipad, long long int macad, long long int detec
int RequestImages(){
printf("Going to request images\n");
eiger_back_ret_val=0;
eiger_back_message_length = sprintf(eiger_back_message,"requestimages %d",0);
return EigerBackSendCMD();
}
int SetDestinationParameters(int i){
SetLeftDestinationParameters(i);
return SetRightDestinationParameters(i);
}
int SetLeftDestinationParameters(int i){
eiger_back_ret_val=0;
eiger_back_message_length = sprintf(eiger_back_message,"setdstparameters %d %d %d",0,1,i);
return EigerBackSendCMD();
}
int SetRightDestinationParameters(int i){
eiger_back_ret_val=0;
eiger_back_message_length = sprintf(eiger_back_message,"setdstparameters %d %d %d",0,32,i);
return EigerBackSendCMD();
}

View File

@ -813,8 +813,10 @@ bool FebControl::AcquisitionInProgress(){
for(unsigned int i=1;i<modules.size();i++){
unsigned int status_reg_r=0,status_reg_l=0;
if(!(GetDAQStatusRegister(modules[i]->GetTopLeftAddress(),status_reg_r)&&GetDAQStatusRegister(modules[i]->GetTopRightAddress(),status_reg_l))){
for(int i=0;i<100;i++) cout<<"Waring trouble reading status register. Returning zero to avoid inifite loops, this could cause trouble!"<<endl;
/**edited by dhanya*/
/* if(!(GetDAQStatusRegister(modules[i]->GetTopLeftAddress(),status_reg_r)&&GetDAQStatusRegister(modules[i]->GetTopRightAddress(),status_reg_l))){*/
if(!(GetDAQStatusRegister(modules[i]->GetTopLeftAddress(),status_reg_r)||GetDAQStatusRegister(modules[i]->GetTopRightAddress(),status_reg_l))){
for(int i=0;i<2;i++) cout<<"Waring trouble reading status register. Returning zero to avoid inifite loops, this could cause trouble!"<<endl;
return 0; //to avoid inifite loops
}
if((status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING) return 1;

View File

@ -11,11 +11,20 @@
#include "EigerHighLevelFunctions.c"
#include "EigerBackEndFunctions.c"
int tempframes;
int64_t timewait1;
int64_t timewait2;
enum detectorSettings thisSettings = STANDARD;
//static const string dacNames[16] = {"Svp","Svn","Vtr","Vrf","Vrs","Vtgstv","Vcmp_ll","Vcmp_lr","Cal","Vcmp_rl","Vcmp_rr","Rxb_rb","Rxb_lb","Vcp","Vcn","Vis"};
int initDetector(){
printf("EIGER Server\n");
printf("This is the EIGER Server\n");
//set number of frames to 1
setTimer(FRAME_NUMBER,1);
setTimer(ACQUISITION_TIME,1E9);
setTimer(ACQUISITION_TIME,1E9);
return 1;
}
@ -217,6 +226,7 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
int startStateMachine(){
printf("Going to start acquisition\n");
EigerStartAcquisition();
RequestImages();
return OK;
}
@ -229,8 +239,7 @@ int stopStateMachine(){
int startReadOut(){
//template startReadOut() from firmware_funcs.c
//send fpga start readout
RequestImages();
return FAIL;
}
@ -249,9 +258,15 @@ enum runStatus getRunStatus(){
char *readFrame(int *ret, char *mess){
RequestImages(); /** polling should be done in server */
while(EigerRunStatus())
usleep(50000);
int i;
int64_t t;
t=timewait1>timewait2?timewait1:timewait2;
/*RequestImages();done inside startacqusition *//** polling should be done in server */
printf("status:%d\n",EigerRunStatus());
/*while(EigerRunStatus())*/
printf("going to randomly wait for %f us\n",tempframes*(t/1000));
for(i=0;i<tempframes;i++)
usleep(t/1000);/*get status doesnt work.so temporarily wait for 2s*#frames*/
*ret = (int)FINISHED;
return NULL;
}
@ -264,16 +279,20 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
if(val >= 0){
printf(" Setting number of frames: %d\n",(unsigned int)val);
EigerSetNumberOfExposures((unsigned int)val);
SetDestinationParameters(val);
tempframes = val;
}return EigerGetNumberOfExposures();
case ACQUISITION_TIME:
if(val >= 0){
printf(" Setting exp time: %fs\n",val/(1E9));
EigerSetExposureTime(val/(1E9));
timewait1 = val;
}return (EigerGetExposureTime()*(1E9));
case FRAME_PERIOD:
if(val >= 0){
printf(" Setting acq period: %fs\n",val/(1E9));
EigerSetExposurePeriod(val/(1E9));
timewait2 = val;
}return (EigerGetExposurePeriod()*(1E9));
/* case DELAY_AFTER_TRIGGER:
if(val >= 0)

View File

@ -999,7 +999,9 @@ string slsDetectorCommand::cmdData(int narg, char *args[], int action) {
myDet->setThreadedProcessing(0);
myDet->setOnline(ONLINE_FLAG);
myDet->readAll();
myDet->processData(1);
//processdata in receiver is useful only for gui purposes
if(myDet->setReceiverOnline()==OFFLINE_FLAG)
myDet->processData(1);
myDet->setThreadedProcessing(b);
return string("");
}
@ -1031,7 +1033,9 @@ string slsDetectorCommand::cmdFrame(int narg, char *args[], int action) {
myDet->setThreadedProcessing(0);
myDet->setOnline(ONLINE_FLAG);
myDet->readFrame();
myDet->processData(1);
//processdata in receiver is useful only for gui purposes
if(myDet->setReceiverOnline()==OFFLINE_FLAG)
myDet->processData(1);
myDet->setThreadedProcessing(b);
return string("ok");
}
@ -4012,10 +4016,11 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
else if(!strcasecmp(args[1],"stop")){
myDet->startReceiverReadout();
runStatus s = myDet->getReceiverStatus();
while((s != RUN_FINISHED)&&(s != IDLE))
while(s != RUN_FINISHED){
usleep(50000);
if(s != IDLE)
myDet->stopReceiver();
s = myDet->getReceiverStatus();
}
myDet->stopReceiver();
}
else
return helpReceiver(narg, args, action);