Merge branch 'master' of gitorious.psi.ch:sls_det_software/sls_detector_software

Conflicts:
	multiSlsDetector/multiSlsDetector.cpp
This commit is contained in:
bergamaschi 2014-11-25 11:46:34 +01:00
commit 91344f54d9
29 changed files with 350 additions and 160 deletions

View File

@ -10,11 +10,21 @@ CFLAGS= -g -DC_ONLY -fPIC
DFLAGS= -g -DDACS_INT
INCLUDES?= -IcommonFiles -IslsDetector -I../slsReceiverSoftware/MySocketTCP -IusersFunctions -ImultiSlsDetector -IslsDetectorUtils -IslsDetectorCommand -IslsDetectorAnalysis -IslsReceiverInterface -I../slsReceiverSoftware/includes -I$(ASM)
INCLUDES?= -IcommonFiles -IslsDetector -I../slsReceiverSoftware/MySocketTCP -IusersFunctions -ImultiSlsDetector -IslsDetectorUtils -IslsDetectorCommand -IslsDetectorAnalysis -IslsReceiverInterface -I../slsReceiverSoftware/include -I$(ASM)
#EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom
SRC_CLNT=slsDetectorAnalysis/fileIO.cpp ../slsReceiverSoftware/MySocketTCP/MySocketTCP.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/angularConversionStatic.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsDetector/slsDetectorUsers.cpp slsDetectorAnalysis/postProcessingFuncs.cpp slsReceiverInterface/receiverInterface.cpp
SRC_CLNT=slsDetectorAnalysis/fileIO.cpp usersFunctions/usersFunctions.cpp slsDetector/slsDetectorUtils.cpp slsDetector/slsDetectorCommand.cpp slsDetectorAnalysis/angularConversion.cpp slsDetectorAnalysis/angularConversionStatic.cpp slsDetectorAnalysis/energyConversion.cpp slsDetector/slsDetectorActions.cpp slsDetectorAnalysis/postProcessing.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsDetectorAnalysis/postProcessingFuncs.cpp slsReceiverInterface/receiverInterface.cpp
# ../slsReceiverSoftware/MySocketTCP/MySocketTCP.cpp
# slsDetector/slsDetectorUsers.cpp
$(info )
$(info #######################################)
$(info # Compiling slsDetectorSoftware #)
$(info #######################################)
$(info )
@ -58,7 +68,6 @@ gotthardVirtualServer: $(SRC_MYTHEN_SVC)
%.o : %.cpp %.h Makefile
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread #$(FLAGS)
package: $(OBJS) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a

View File

@ -42,6 +42,7 @@
short Beb_bit_mode;
void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num){
bebInfo->beb_number=beb_num;
bebInfo->serial_address=0;
@ -136,13 +137,14 @@ void Beb_Beb(int arg1){
Beb_SetByteOrder();
/*
ll_beb_new_memory = &ll_beb_new_memory_local;
Local_LocalLinkInterface(ll_beb_new_memory);
if(!Local_InitNewMemory(ll_beb_new_memory,XPAR_PLB_LL_NEW_MEMORY, arg1))
printf("New Memory FAIL\n");
else
printf("New Memory OK\n");
*/
}
@ -156,6 +158,7 @@ void Beb_ClearBebInfos(){
int Beb_InitBebInfos(){//file name at some point
Beb_ClearBebInfos();
struct BebInfo b0;
BebInfo_BebInfo(&b0,0);
if(BebInfo_SetSerialAddress(&b0,0xff)) { //all bebs for reset and possibly get request data?
@ -173,6 +176,7 @@ int Beb_InitBebInfos(){//file name at some point
beb_infos.push_back(b);
*/
return Beb_CheckSourceStuffBebInfo();
}
@ -182,7 +186,7 @@ int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig, char* src_mac
//so that the values can be reset externally for now....
unsigned int i = Beb_GetBebInfoIndex(beb_number);
if(!i){ printf("returning 000\n");return 0;} //i must be greater than 0, zero is the global send
/******* if(!i) return 0;****************************/ //i must be greater than 0, zero is the global send
BebInfo_SetHeaderInfo(&beb_infos[i],ten_gig,src_mac,src_ip,src_port);
printf("Printing Beb info number (%d) :\n",i);
@ -254,12 +258,13 @@ int Beb_CheckSourceStuffBebInfo(){
}
unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb){
if(!beb_numb) return 0;
/******************** if(!beb_numb) return 0;******************************/
unsigned int i;
for(i=1;i<bebInfoSize;i++)
if(beb_numb==BebInfo_GetBebNumber(&beb_infos[i]))
if(beb_numb==BebInfo_GetBebNumber(&beb_infos[i])){
printf("found beb index:%d, for beb number:%d\n",i,beb_numb);
return i;
}
return 0;
}
@ -320,7 +325,7 @@ int Beb_SetByteOrder(){
int Beb_SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int header_number, char* dst_mac, char* dst_ip, unsigned int dst_port){
unsigned int i = Beb_GetBebInfoIndex(beb_number);
if(!i) return 0; //i must be greater than 0, zero is the global send
/***********************************if(!i) return 0; *************************************///i must be greater than 0, zero is the global send
Beb_send_ndata = 14;
Beb_send_data[0] = ten_gig ? 0x00020000 : 0x00010000; //write to fanout numbers 1 or 2
@ -337,7 +342,7 @@ int Beb_SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int header
int Beb_SetHeaderData(unsigned int beb_number, int ten_gig, char* dst_mac, char* dst_ip, unsigned int dst_port){
unsigned int i = Beb_GetBebInfoIndex(beb_number);
if(!i) return 0; //i must be greater than 0, zero is the global send
/***********************************if(!i) return 0; *************************************///i must be greater than 0, zero is the global send
return Beb_SetHeaderData1(BebInfo_GetSrcMAC(&beb_infos[i],ten_gig),BebInfo_GetSrcIP(&beb_infos[i],ten_gig),BebInfo_GetSrcPort(&beb_infos[i],ten_gig),dst_mac,dst_ip,dst_port);
}

View File

@ -53,7 +53,9 @@ unsigned int Feb_Control_trimbit_size;
unsigned int* Feb_Control_last_downloaded_trimbits;
int Feb_Control_current_mod;
int Feb_Control_current_index;
int Feb_Control_am_i_master;
void Module_Module(struct Module* mod,unsigned int number, unsigned int address_top){
unsigned int i;
@ -142,12 +144,17 @@ int Module_GetBottomDACValue(struct Module* mod,unsigned int i)
int Feb_Control_IsBottomModule(){
if(Module_BottomAddressIsValid(&modules[1]))
if(Module_BottomAddressIsValid(&modules[Feb_Control_current_index]))
return 1;
return 0;
}
int Feb_Control_GetModuleNumber(){
return Feb_Control_current_mod;
}
void Feb_Control_FebControl(){
Feb_Control_staticBits=Feb_Control_acquireNReadoutMode=Feb_Control_triggerMode=Feb_Control_externalEnableMode=Feb_Control_subFrameMode=0;
@ -155,6 +162,7 @@ void Feb_Control_FebControl(){
Feb_Control_trimbit_size=263680;
Feb_Control_last_downloaded_trimbits = malloc(Feb_Control_trimbit_size * sizeof(int));
/*
printf("\nDefault Settings:\n");
Feb_Control_nimages = 1;
Feb_Control_exposure_time_in_sec = 1;
@ -171,6 +179,23 @@ void Feb_Control_FebControl(){
printf("\n\n");
Feb_Control_Init();
*/
/*
unsigned int reg_nums[1];
unsigned int reg_vals[1];
reg_nums[0]=DAQ_REG_CHIP_CMDS;
reg_vals[0]=(0|Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),1,reg_nums,reg_vals,0,0)){
printf("Trouble setting them up as slaves\n");;
}
*/
}
@ -184,36 +209,98 @@ void Feb_Control_ClearModules(){
int Feb_Control_Init(){
unsigned int i;
Feb_Control_ClearModules();
/*Feb_Control_AddModule(0,0xff);//global send
///*
Feb_Control_current_mod = 0;
Feb_Control_current_index = 0;
Feb_Control_AddModule(0,0xff);//global send
Feb_Control_PrintModuleList();*/
Feb_Control_PrintModuleList();
//*/
Feb_Control_ReadSetUpFileToAddModules("/home/root/executables/setup.txt");
/*
printf("\nSetting detector defaults:\n");
Feb_Control_ReadSetUpFile(0,"/home/root/executables/setup.txt"); //send defaults to all
for(i=1;i<moduleSize;i++){
/* for(i=1;i<moduleSize;i++){
char st[2000];
sprintf(st,"setup_mod%04d.txt",Module_GetModuleNumber(&modules[i]));
//Feb_Control_ReadSetUpFile(Module_GetModuleNumber(&modules[i]),st);
}
sprintf(st,"setup_mod%04d.txt",Module_GetModuleNumber(&modules[i]));
Feb_Control_ReadSetUpFile(Module_GetModuleNumber(&modules[i]),st);
}*/
//get module nummber
int res=0;
char hostname[100];
if (gethostname(hostname, sizeof hostname) == 0)
puts(hostname);
else
perror("gethostname");
char *pch;
pch = strtok(hostname,"0");
pch = strtok(NULL,"0");
sscanf(pch,"%d",&res);
Feb_Control_current_mod = (res & 0xFF);
return Feb_Control_CheckSetup();
for(i=1;i<moduleSize;i++){
if(Module_GetModuleNumber(&modules[i])==Feb_Control_current_mod)
Feb_Control_current_index = i;
}
/*Feb_Control_ReadSetUpFile(Feb_Control_current_mod,"/home/root/executables/setup.txt");
printf("Done setting detector defaults\n");*/
Feb_Control_am_i_master = 0;
return 1;
}
void Feb_Control_Set_Master(){
Feb_Control_am_i_master = 1;
/*
unsigned int halfmastermodule = 0x80000000;
unsigned int reg_nums[1];
unsigned int reg_vals[1];
reg_nums[0]=DAQ_REG_CHIP_CMDS;
reg_vals[0]=(halfmastermodule|Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
if(!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),1,reg_nums,reg_vals,0,0)){
printf("Trouble writing commands....\n");;
return 0;
}
printf("master is set\n");
*/
}
int Feb_Control_ReadSetUpFileToAddModules(char* file_name){
char line[100];
char str[100];
int i0,i1,i2;
int memaddress = 1;
FILE* fp = fopen(file_name, "r");
if( fp == NULL ){
perror("Error while opening the file.\n");
return 0;
}
printf("\nSetting up detector:\n");
printf("\nSetting up detectors:\n");
while ( fgets (line , 255 , fp) != NULL ){
if(strlen(line)<=1)
@ -236,29 +323,34 @@ int Feb_Control_ReadSetUpFileToAddModules(char* file_name){
}
else if(!strcmp(str,"add_half_module")){
if( sscanf (line,"%s %d %d", str,&i0,&i1) < 3){
if( sscanf (line,"%s %d %d %d", str,&i0,&i1,&i2) < 4){
printf("Error adding half module from %s.\n",file_name);
exit(0);
}
printf ("str:%s len:%d i0:%d i1:%d\n", str, strlen(str),i0,i1);
printf ("str:%s len:%d i0:%d i1:%d i2:%d\n", str, strlen(str),i0,i1,i2);
/**Added by dhanya*/
if(i1 == 0){
Feb_Control_AddModule1(0,0xff,0,1);//global send
Feb_Control_PrintModuleList();
if(!Feb_Control_AddModule1(i0,i1,0,1)){
/*Feb_Control_AddModule1(0,0xff,0,1);//global send
Feb_Control_PrintModuleList();*/
if(!Feb_Control_AddModule1(i0,i2,0,1)){
printf("Error adding module, parameter was assigned twice in setup file: %s.\n",file_name);
exit(0);
}
}else{
Feb_Control_AddModule1(0,0,0xff,1);//global send
Feb_Control_PrintModuleList();
if(!Feb_Control_AddModule1(i0,0,i1,1)){
/* Feb_Control_AddModule1(0,0,0xff,1);//global send
Feb_Control_PrintModuleList();*/
if(!Feb_Control_AddModule1(i0,0,i2,1)){
printf("Error adding module, parameter was assigned twice in setup file: %s.\n",file_name);
exit(0);
}
}
//memaddress++;
Feb_Control_PrintModuleList();
/* if(!Feb_Control_AddModule1(i0,i1)){
printf("Error adding module, parameter was assigned twice in setup file: %s.\n",file_name);
@ -345,7 +437,6 @@ int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address){
int Feb_Control_AddModule1(unsigned int module_number, unsigned int top_address, unsigned int bottom_address, int half_module){ //bot_address 0 for half module
int parameters_ok = 1;
unsigned int pre_module_index = 0;
if(Feb_Control_GetModuleIndex(module_number,&pre_module_index)){
printf("\tRemoving previous assignment of module number %d.\n",module_number);
// free(modules[pre_module_index]);
@ -391,7 +482,7 @@ int Feb_Control_AddModule1(unsigned int module_number, unsigned int top_address,
int Feb_Control_ReadSetUpFile(unsigned int module_num, char* file_name){
printf("Reading Setup file for module number:%d\n",module_num);
char line[100];
char str[100];
int i0;
@ -465,23 +556,26 @@ int Feb_Control_ReadSetUpFile(unsigned int module_num, char* file_name){
}
if(module_num>0)
sprintf(str,"mod%d::%s",module_num,str);
sprintf(str,"%s",str); /*sprintf(str,"mod%d::%s",module_num,str);*/
if(!Feb_Control_SetDAC(str,f0,1))
printf("error in string: %s",str);
}
}
fclose(fp);
printf("Done reading set up file\n");
return 1;
}
int Feb_Control_CheckSetup(){
printf("Checking Set up\n");
unsigned int i,j;
int ok = 1;
for(i=0;i<moduleSize;i++){
/*for(i=0;i<moduleSize;i++){*/
i = Feb_Control_current_index;
for(j=0;j<4;j++){
if(Module_GetTopIDelay(&modules[i],j)<0){
printf("Warning: module %d's idelay top number %d not set.\n",Module_GetModuleNumber(&modules[i]),j);
@ -506,8 +600,8 @@ int Feb_Control_CheckSetup(){
ok=0;
}
}
}
/* }*/
printf("Done Checking Set up\n");
return ok;
}
@ -646,16 +740,20 @@ float Feb_Control_DACToVoltage(unsigned int digital,unsigned int nsteps,float vm
int Feb_Control_SetHighVoltage(float value){
return Feb_Control_SetHighVoltage1(0,value);
return Feb_Control_SetHighVoltage1(Feb_Control_current_mod,value);
}
int Feb_Control_SetHighVoltage1(unsigned int module_num,float value){
unsigned int module_index=0;
unsigned int i;
if(!Feb_Control_GetModuleIndex(module_num,&module_index)||!Module_TopAddressIsValid(&modules[module_index])){
printf("Error could not set high voltage module number %d invalid.\n",module_num);
return 0;
}
if(Module_TopAddressIsValid(&modules[module_index])){
if(!Feb_Control_GetModuleIndex(module_num,&module_index)){/*||!Module_TopAddressIsValid(&modules[module_index])){*/
printf("Error could not set high voltage module number %d invalid.\n",module_num);
return 0;
}
}else
return 0;
if(!Feb_Control_SendHighVoltage(Module_GetTopRightAddress(&modules[module_index]),&value)) return 0;
@ -696,8 +794,9 @@ int Feb_Control_SendHighVoltage(unsigned int dst_num,float* value){
int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int* top, int* bottom, unsigned int* dac_ch){
char* local_s = dac_str;
char temp[50];
*module_index = 1;
*module_index = Feb_Control_current_index;
/*
char* p1 = strstr(local_s,"mod");//size_t p1 = local_s.find("mod");
char* p2 = strstr(local_s,"::");//size_t p2 =local_s.find("::");
if(p1!=NULL&&p2!=NULL&&(p1+3)<p2){//if(p1!=string::npos&&p2!=string::npos&&(p1+3)<p2){
@ -711,7 +810,7 @@ int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int*
}
strcpy(local_s,p2+2);//local_s = local_s.substr(p2+2);
}
*/
*top = 1;//make them both 1 instead of this
*bottom = 1;
@ -960,8 +1059,8 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits){
} //end row loop
if(Module_TopAddressIsValid(&modules[0])){
if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[1]),0,0,1024,trimbits_to_load_r)||
!Feb_Interface_WriteMemoryInLoops(Module_GetTopRightAddress(&modules[1]),0,0,1024,trimbits_to_load_l)||
if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_r)||
!Feb_Interface_WriteMemoryInLoops(Module_GetTopRightAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_l)||
//if(!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)||
// !Feb_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)||
!Feb_Control_StartDAQOnlyNWaitForFinish(5000)){
@ -969,8 +1068,8 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits){
return 0;
}
}else{
if(!Feb_Interface_WriteMemoryInLoops(Module_GetBottomLeftAddress(&modules[1]),0,0,1024,trimbits_to_load_r)||
!Feb_Interface_WriteMemoryInLoops(Module_GetBottomRightAddress(&modules[1]),0,0,1024,trimbits_to_load_l)||
if(!Feb_Interface_WriteMemoryInLoops(Module_GetBottomLeftAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_r)||
!Feb_Interface_WriteMemoryInLoops(Module_GetBottomRightAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_l)||
//if(!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)||
// !Feb_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)||
!Feb_Control_StartDAQOnlyNWaitForFinish(5000)){
@ -995,15 +1094,22 @@ unsigned int* Feb_Control_GetTrimbits(){
unsigned int Feb_Control_AddressToAll(){
unsigned int Feb_Control_AddressToAll(){printf("in Feb_Control_AddressToAll()\n");
if(moduleSize==0) return 0;
if(Module_BottomAddressIsValid(&modules[0])){
//printf("************* bottom\n");
return Module_GetBottomLeftAddress(&modules[0])|Module_GetBottomRightAddress(&modules[0]);
if(Module_BottomAddressIsValid(&modules[1])){
printf("************* bottom\n");
//if(Feb_Control_am_i_master)
return Module_GetBottomLeftAddress(&modules[1])|Module_GetBottomRightAddress(&modules[1]);
// else return 0;
}
//printf("************* top\n");
return Module_GetTopLeftAddress(&modules[0])|Module_GetTopRightAddress(&modules[0]);
printf("************* top\n");
// if(Feb_Control_am_i_master)
return Module_GetTopLeftAddress(&modules[0])|Module_GetTopRightAddress(&modules[0]);
// else return 0;
}
@ -1049,22 +1155,21 @@ int Feb_Control_WaitForFinishedFlag(int sleep_time_us){
int Feb_Control_AcquisitionInProgress(){
unsigned int status_reg_r=0,status_reg_l=0;
int ind = Feb_Control_current_index;
if(Module_BottomAddressIsValid(&modules[ind])){
//printf("right:%d\n",Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[1]),&status_reg_r));
//printf("left:%d\n",Feb_Control_GetDAQStatusRegister(Module_GetTopLeftAddress(&modules[1]),&status_reg_l));
if(!(Feb_Control_GetDAQStatusRegister(Module_GetBottomRightAddress(&modules[ind]),&status_reg_r)))
{printf("ERROR: Trouble reading Status register. bottom right address\n");return 0;}
if(!(Feb_Control_GetDAQStatusRegister(Module_GetBottomLeftAddress(&modules[ind]),&status_reg_l)))
{printf("ERROR: Trouble reading Status register. bottom left address\n");return 0;}
if(Module_BottomAddressIsValid(&modules[1])){
//printf("************* bottom1\n");
if(!(Feb_Control_GetDAQStatusRegister(Module_GetBottomRightAddress(&modules[1]),&status_reg_r)))
return 0;
}else{
//printf("************* top1\n");
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[1]),&status_reg_r)))
return 0;
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[ind]),&status_reg_r)))
{printf("ERROR: Trouble reading Status register. top right address\n");return 0;}
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopLeftAddress(&modules[ind]),&status_reg_l)))
{printf("ERROR: Trouble reading Status register. top left address\n");return 0;}
}
if(status_reg_r&DAQ_STATUS_DAQ_RUNNING) return 1;
if((status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING) {/*printf("**runningggg\n");*/return 1;}
/*
if(!(GetDAQStatusRegister(modules[i]->Module_GetTopLeftAddress(),status_reg_r)&&GetDAQStatusRegister(modules[i]->Module_GetTopRightAddress(),status_reg_l))){
@ -1075,7 +1180,8 @@ int Feb_Control_AcquisitionInProgress(){
}
*/
/*printf("**idle\n");*/return 0; //i.e. not running (status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING;
/*printf("**idle\n");*/
return 0; //i.e. not running (status_reg_r|status_reg_l)&DAQ_STATUS_DAQ_RUNNING;
}
int Feb_Control_Reset(){
@ -1246,8 +1352,8 @@ int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity){
}
int Feb_Control_SetNExposures(unsigned int n_images){
if(!Feb_Control_nimages){
printf("Warning nimages must be greater than zero.%d\n",Feb_Control_nimages);
if(!n_images){
printf("Warning nimages must be greater than zero.%d\n",n_images);
return 0;
}
@ -1401,7 +1507,7 @@ int Feb_Control_StartAcquisition(){printf("****** starting acquisition*********
return 0;
}
if(!Feb_Control_SetStaticBits(Feb_Control_staticBits&(DAQ_STATIC_BIT_M4|DAQ_STATIC_BIT_M8))){
if(!Feb_Control_SetStaticBits1(Feb_Control_staticBits&(DAQ_STATIC_BIT_M4|DAQ_STATIC_BIT_M8))){
printf("Trouble setting static bits ...\n");;
return 0;
}
@ -1416,6 +1522,7 @@ int Feb_Control_StartAcquisition(){printf("****** starting acquisition*********
return 0;
}
reg_nums[0]=DAQ_REG_CTRL;
reg_vals[0]=0;
reg_nums[1]=DAQ_REG_NEXPOSURES;
@ -1424,6 +1531,53 @@ int Feb_Control_StartAcquisition(){printf("****** starting acquisition*********
reg_vals[2]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_time_in_sec);
reg_nums[3]=DAQ_REG_EXPOSURE_REPEAT_TIMER;
reg_vals[3]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_period_in_sec);
///*
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),4,reg_nums,reg_vals,0,0)){
printf("Trouble starting acquisition....\n");;
return 0;
}
unsigned int masterHalfModuleMode = 0;
reg_nums[0]=DAQ_REG_CHIP_CMDS;
reg_vals[0]=(masterHalfModuleMode|Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),1,reg_nums,reg_vals,0,0)){
printf("Trouble writing commands....\n");;
return 0;
}
/*
masterHalfModuleMode = 0x80000000;
reg_nums[0]=DAQ_REG_CHIP_CMDS;
reg_vals[0]=(masterHalfModuleMode|Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
if(!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),1,reg_nums,reg_vals,0,0)){
printf("Trouble writing commands....\n");;
return 0;
}
*/
//if(!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),1,reg_nums,reg_vals,0,0)){
///*
int i;
for(i=0;i<14;i++){
reg_nums[i]=DAQ_REG_CTRL;
reg_vals[i]=0;
}
reg_nums[14]=DAQ_REG_CTRL;
reg_vals[14]=ACQ_CTRL_START;
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),15,reg_nums,reg_vals,0,0)){
printf("Trouble starting acquisition....\n");;
return 0;
}
//*/
/*
reg_nums[4]=DAQ_REG_CHIP_CMDS;
reg_vals[4]=(Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
int i;
@ -1434,11 +1588,12 @@ int Feb_Control_StartAcquisition(){printf("****** starting acquisition*********
reg_nums[19]=DAQ_REG_CTRL;
reg_vals[19]=ACQ_CTRL_START;
// if(!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),20,reg_nums,reg_vals,0,0)){
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),20,reg_nums,reg_vals,0,0)){
printf("Trouble starting acquisition....\n");;
return 0;
}
*/
return 1;
}

View File

@ -66,7 +66,8 @@ int Module_GetBottomDACValue(struct Module* mod,unsigned int i);
int Feb_Control_IsBottomModule();
int Feb_Control_GetModuleNumber();
void Feb_Control_Set_Master();
void Feb_Control_ClearModules();
@ -102,7 +103,7 @@ int Feb_Control_IsBottomModule();
int Feb_Control_ResetChipCompletely();
struct sockaddr_in Feb_Control_serv_addr;
//struct sockaddr_in Feb_Control_serv_addr;
/*
int Feb_Control_SetupSendToSocket(const char* ip_address_hostname, unsigned short int port);
int Feb_Control_WriteNRead(char* message, int length, int max_length);

View File

@ -36,4 +36,4 @@ beb_debug:$(SRC_CLNT3)
clean:
rm -rf $(DESTDIR)/$(PROGS) *.o

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: c31619c88e5690230fcd389dc18f9139295c442c
Revision: 91
Repsitory UUID: ce7cd6255b7b3abf1c046e9703ae8288ec55135a
Revision: 97
Branch: master
Last Changed Author: Maliakal_Dhanya
Last Changed Rev: 280
Last Changed Date: 2014-09-09 15:43:18 +0200
Last Changed Rev: 282
Last Changed Date: 2014-10-16 13:49:56 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer"
//#define SVNREPPATH ""
#define SVNREPUUID "c31619c88e5690230fcd389dc18f9139295c442c"
//#define SVNREV 0x280
#define SVNREPUUID "ce7cd6255b7b3abf1c046e9703ae8288ec55135a"
//#define SVNREV 0x282
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya"
#define SVNREV 0x280
#define SVNDATE 0x20140909
#define SVNREV 0x282
#define SVNDATE 0x20141016
//

View File

@ -105,6 +105,7 @@ int initDetector(){
Feb_Interface_FebInterface();
Feb_Control_FebControl();
Feb_Control_Init();
printf("FEb control constructor done\n");
Beb_Beb(-1);
printf("BEB constructor done\n");
@ -126,16 +127,32 @@ int initDetector(){
setThresholdEnergy(8000,0);
setReadOutFlags(PARALLEL);
setSpeed(0,1);//clk_devider,half speed
setHighVolage(150,0);
setHighVolage(150,0);
setIODelay(675,0);
setTiming(AUTO_TIMING);
//setMaster(GET_MASTER);
int enable[2] = {0,1};
setExternalGating(enable);//disable external gating
if(getDetectorNumber() == 0xbeb031)
trialMasterMode = IS_MASTER;
Feb_Control_SetTestModeVariable(0);
Feb_Control_CheckSetup();
//if(!Feb_Control_IsBottomModule()){
//if(getDetectorNumber()==0xbeb031){
printf("************** master ********************\n");
trialMasterMode = IS_MASTER;
Feb_Control_Set_Master();
//}
//else printf("************** slave ********************\n");
if(Feb_Control_IsBottomModule())
printf("BOTTOM ***************\n");
else
printf("TOP ***************\n");
return 1;
}
@ -325,7 +342,7 @@ int getADC(enum detDacIndex ind, int imod){
int setIODelay(int val, int imod){
if(val!=-1){
printf(" Setting IO Delay: %d\n",val);
if(Feb_Control_SetIDelays(0,val))
if(Feb_Control_SetIDelays(Feb_Control_GetModuleNumber(),val))
eiger_iodelay = val;
}
return eiger_iodelay;
@ -382,7 +399,7 @@ int setModule(sls_detector_module myMod){
}
Feb_Control_SetTrimbits(0,tt);
Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(),tt);
return 0;
@ -456,32 +473,25 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
int startStateMachine(){
int ret;
if(trialMasterMode == IS_MASTER){
printf("Going to start acquisition\n");
Feb_Control_StartAcquisition();
}
printf("requesting images\n");
//RequestImages();
int ret_val = 0;
dst_requested[0] = 1;
while(dst_requested[on_dst]){
//waits on data
if((ret_val = (!Beb_RequestNImages(0,1,send_to_ten_gig,on_dst,nimages_per_request,0)||
!Beb_RequestNImages(0,2,send_to_ten_gig,0x20|on_dst,nimages_per_request,0))))
break;
dst_requested[on_dst++]=0;
on_dst%=ndsts_in_use;
//if(trialMasterMode == IS_MASTER){
printf("requesting images\n");
ret = startReadOut();
//}
if(trialMasterMode == IS_MASTER){
/*for(i=0;i<3;i++)
usleep(1000000);*/
while(getRunStatus() == IDLE);
printf("Acquiring..\n");
}
printf("Returning\n");
if(ret_val)
return FAIL;
else
return OK;
return FAIL;
return ret;
}
@ -502,8 +512,10 @@ int startReadOut(){
dst_requested[0] = 1;
while(dst_requested[on_dst]){
//waits on data
if((ret_val = (!Beb_RequestNImages(0,1,send_to_ten_gig,on_dst,nimages_per_request,0)||
!Beb_RequestNImages(0,2,send_to_ten_gig,0x20|on_dst,nimages_per_request,0))))
int beb_num = 24;//Feb_Control_GetModuleNumber();
if((ret_val = (!Beb_RequestNImages(beb_num,1,send_to_ten_gig,on_dst,nimages_per_request,0)||
!Beb_RequestNImages(beb_num,2,send_to_ten_gig,0x20|on_dst,nimages_per_request,0))))
break;
dst_requested[on_dst++]=0;
on_dst%=ndsts_in_use;
@ -513,20 +525,22 @@ int startReadOut(){
return FAIL;
else
return OK;
return OK;
}
enum runStatus getRunStatus(){
if(trialMasterMode == IS_MASTER){
int i = Feb_Control_AcquisitionInProgress();
if(i== 0){
/*printf("IDLE\n");*/
//printf("IDLE\n");
return IDLE;
}else{
/*printf("RUNNING\n");*/
//printf("RUNNING\n");
return RUNNING;
}
}
return IDLE;
}
@ -534,6 +548,8 @@ enum runStatus getRunStatus(){
char *readFrame(int *ret, char *mess){
if(!Feb_Control_WaitForFinishedFlag(5000))
printf("error in waiting for finished flag\n");
printf("acquisition finished\n");
*ret = (int)FINISHED;
return NULL;
}
@ -549,8 +565,8 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
switch(ind){
case FRAME_NUMBER:
if(val >= 0){
printf(" Setting number of frames: %d\n",(unsigned int)val);
if(Feb_Control_SetNExposures((unsigned int)val)*eiger_ncycles){
printf(" Setting number of frames: %d * %d\n",(unsigned int)val,eiger_ncycles);
if(Feb_Control_SetNExposures((unsigned int)val*eiger_ncycles)){
eiger_nexposures = val;
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
on_dst = 0;
@ -587,7 +603,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
return EigerGetNumberOfExposures();*/
case CYCLES_NUMBER:
if(val >= 0){
printf(" Setting number of triggers: %d\n",(unsigned int)val);
printf(" Setting number of triggers: %d * %d\n",(unsigned int)val,eiger_nexposures);
if(Feb_Control_SetNExposures((unsigned int)val*eiger_nexposures)){
eiger_ncycles = val;
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
@ -710,7 +726,7 @@ int configureMAC(int ipad, long long int macad, long long int detectormacadd, in
printf("dst_mac:%s\n",dst_mac);
int beb_num = 34;
int beb_num = 24;//Feb_Control_GetModuleNumber();
int header_number = 0;
int dst_port = udpport;

View File

@ -1 +1 @@
../../slsReceiverSoftware/includes/sls_receiver_defs.h
../../slsReceiverSoftware/include/sls_receiver_defs.h

View File

@ -1 +1 @@
../../slsReceiverSoftware/includes/sls_receiver_funcs.h
../../slsReceiverSoftware/include/sls_receiver_funcs.h

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: c31619c88e5690230fcd389dc18f9139295c442c
Revision: 852
Repsitory UUID: ce7cd6255b7b3abf1c046e9703ae8288ec55135a
Revision: 865
Branch: master
Last Changed Author: Maliakal_Dhanya
Last Changed Rev: 852
Last Changed Date: 2014-09-09 15:43:18 +0200
Last Changed Rev: 865
Last Changed Date: 2014-10-16 13:49:56 +0200

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: c31619c88e5690230fcd389dc18f9139295c442c
Revision: 173
Repsitory UUID: ce7cd6255b7b3abf1c046e9703ae8288ec55135a
Revision: 175
Branch: master
Last Changed Author: Maliakal_Dhanya
Last Changed Rev: 280
Last Changed Date: 2014-09-09 15:43:18 +0200
Last Changed Rev: 282
Last Changed Date: 2014-10-16 13:49:56 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer"
//#define SVNREPPATH ""
#define SVNREPUUID "c31619c88e5690230fcd389dc18f9139295c442c"
//#define SVNREV 0x280
#define SVNREPUUID "ce7cd6255b7b3abf1c046e9703ae8288ec55135a"
//#define SVNREV 0x282
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya"
#define SVNREV 0x280
#define SVNDATE 0x20140909
#define SVNREV 0x282
#define SVNDATE 0x20141016
//

View File

@ -1 +1 @@
../../slsReceiverSoftware/includes/sls_receiver_defs.h
../../slsReceiverSoftware/include/sls_receiver_defs.h

View File

@ -1 +1 @@
../../slsReceiverSoftware/includes/sls_receiver_funcs.h
../../slsReceiverSoftware/include/sls_receiver_funcs.h

View File

@ -1 +1 @@
../../slsReceiverSoftware/includes/sls_receiver_defs.h
../../slsReceiverSoftware/include/sls_receiver_defs.h

View File

@ -1 +1 @@
../../slsReceiverSoftware/includes/sls_receiver_funcs.h
../../slsReceiverSoftware/include/sls_receiver_funcs.h

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/moenchDetectorServer
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: c31619c88e5690230fcd389dc18f9139295c442c
Revision: 58
Repsitory UUID: ce7cd6255b7b3abf1c046e9703ae8288ec55135a
Revision: 62
Branch: master
Last Changed Author: Maliakal_Dhanya
Last Changed Rev: 280
Last Changed Date: 2014-09-09 15:43:18 +0200
Last Changed Rev: 282
Last Changed Date: 2014-10-16 13:49:56 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer"
//#define SVNREPPATH ""
#define SVNREPUUID "c31619c88e5690230fcd389dc18f9139295c442c"
//#define SVNREV 0x280
#define SVNREPUUID "ce7cd6255b7b3abf1c046e9703ae8288ec55135a"
//#define SVNREV 0x282
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya"
#define SVNREV 0x280
#define SVNDATE 0x20140909
#define SVNREV 0x282
#define SVNDATE 0x20141016
//

View File

@ -1 +1 @@
../../slsReceiverSoftware/includes/sls_receiver_defs.h
../../slsReceiverSoftware/include/sls_receiver_defs.h

View File

@ -1 +1 @@
../../slsReceiverSoftware/includes/sls_receiver_funcs.h
../../slsReceiverSoftware/include/sls_receiver_funcs.h

View File

@ -1528,7 +1528,11 @@ slsDetectorDefs::runStatus multiSlsDetector::getRunStatus() {
return s;
}
<<<<<<< HEAD
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) { //loop started from 0, but it's a problem with only one detector...
=======
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
>>>>>>> 5c16b389923487a754e2a4dd64c8da86c901d4e6
s1=detectors[i]->getRunStatus();
if(detectors[i]->getErrorMask())
setErrorMask(getErrorMask()|(1<<i));

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/mythenDetectorServer
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: c31619c88e5690230fcd389dc18f9139295c442c
Revision: 90
Repsitory UUID: ce7cd6255b7b3abf1c046e9703ae8288ec55135a
Revision: 91
Branch: master
Last Changed Author: Maliakal_Dhanya
Last Changed Rev: 280
Last Changed Date: 2014-09-09 15:43:18 +0200
Last Changed Rev: 282
Last Changed Date: 2014-10-16 13:49:56 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer"
//#define SVNREPPATH ""
#define SVNREPUUID "c31619c88e5690230fcd389dc18f9139295c442c"
//#define SVNREV 0x280
#define SVNREPUUID "ce7cd6255b7b3abf1c046e9703ae8288ec55135a"
//#define SVNREV 0x282
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya"
#define SVNREV 0x280
#define SVNDATE 0x20140909
#define SVNREV 0x282
#define SVNDATE 0x20141016
//

View File

@ -1 +1 @@
../../slsReceiverSoftware/includes/sls_receiver_defs.h
../../slsReceiverSoftware/include/sls_receiver_defs.h

View File

@ -1 +1 @@
../../slsReceiverSoftware/includes/sls_receiver_funcs.h
../../slsReceiverSoftware/include/sls_receiver_funcs.h

View File

@ -1,11 +1,11 @@
//#define SVNPATH ""
#define SVNURLLIB "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git"
//#define SVNREPPATH ""
#define SVNREPUUIDLIB "c31619c88e5690230fcd389dc18f9139295c442c"
//#define SVNREV 0x852
#define SVNREPUUIDLIB "ce7cd6255b7b3abf1c046e9703ae8288ec55135a"
//#define SVNREV 0x865
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTHLIB "Maliakal_Dhanya"
#define SVNREVLIB 0x852
#define SVNDATELIB 0x20140909
#define SVNREVLIB 0x865
#define SVNDATELIB 0x20141016
//

View File

@ -54,7 +54,7 @@ int init_detector(int b) {
#endif
}else{
Feb_Interface_FebInterface();
//Feb_Control_FebControl();
Feb_Control_Init();
// printf("FEb control constructor done\n");
/* Beb_Beb(-1);
printf("BEB constructor done\n");*/
@ -2275,9 +2275,9 @@ int get_run_status(int file_des) {
enum runStatus s;
sprintf(mess,"getting run status\n");
//#ifdef VERBOSE
#ifdef VERBOSE
printf("Getting status\n");
//#endif
#endif
#ifdef SLS_DETECTOR_FUNCTION_LIST
s= getRunStatus();printf("status:%d\n");
#endif