some changes for better testing in eiger server, including using set receiver, and changed to top/bottom instead of master slave

This commit is contained in:
Maliakal Dhanya 2014-11-28 14:26:19 +01:00
parent ceb2d28281
commit 4649de2742
11 changed files with 346 additions and 246 deletions

View File

@ -185,7 +185,7 @@ int Beb_InitBebInfos(){//file name at some point
int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig, char* src_mac, char* src_ip,unsigned int src_port){ int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig, char* src_mac, char* src_ip,unsigned int src_port){
//so that the values can be reset externally for now.... //so that the values can be reset externally for now....
unsigned int i = Beb_GetBebInfoIndex(beb_number); unsigned int i = 1;/*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
BebInfo_SetHeaderInfo(&beb_infos[i],ten_gig,src_mac,src_ip,src_port); BebInfo_SetHeaderInfo(&beb_infos[i],ten_gig,src_mac,src_ip,src_port);
@ -262,9 +262,10 @@ unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb){
unsigned int i; unsigned int i;
for(i=1;i<bebInfoSize;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); printf("*****found beb index:%d, for beb number:%d\n",i,beb_numb);
return i; return i;
} }
printf("*****Returning 0\n");
return 0; return 0;
} }
@ -324,7 +325,8 @@ 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){ 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); unsigned int i = 1;/*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_ndata = 14;
@ -341,7 +343,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){ 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); unsigned int i = 1;/*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); 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);
} }
@ -473,7 +475,7 @@ void Beb_AdjustIPChecksum(struct udp_header_type *ip){
int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, int ten_gig, unsigned int dst_number, unsigned int npackets, unsigned int packet_size, int stop_read_when_fifo_empty){ int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, int ten_gig, unsigned int dst_number, unsigned int npackets, unsigned int packet_size, int stop_read_when_fifo_empty){
unsigned int i = Beb_GetBebInfoIndex(beb_number); //zero is the global send unsigned int i = 1;/*Beb_GetBebInfoIndex(beb_number); //zero is the global send*/
Beb_send_ndata = 3; Beb_send_ndata = 3;
if(left_right == 1) Beb_send_data[0] = 0x00040000; if(left_right == 1) Beb_send_data[0] = 0x00040000;

View File

@ -316,7 +316,7 @@ int Feb_Control_ReadSetUpFileToAddModules(char* file_name){
exit(0); exit(0);
} }
printf ("str:%s len:%d i0:%d i1:%d i2:%d\n", str, strlen(str),i0,i1,i2); printf ("str:%s len:%d i0:%d i1:%d i2:%d\n", str, strlen(str),i0,i1,i2);
if(!Feb_Control_AddModule1(i0,i1,i2,0)){ if(!Feb_Control_AddModule1(i0,1,i1,i2,0)){
printf("Error adding module, parameter was assigned twice in setup file: %s.\n",file_name); printf("Error adding module, parameter was assigned twice in setup file: %s.\n",file_name);
exit(0); exit(0);
} }
@ -329,26 +329,11 @@ int Feb_Control_ReadSetUpFileToAddModules(char* file_name){
} }
printf ("str:%s len:%d i0:%d i1:%d i2:%d\n", str, strlen(str),i0,i1,i2); printf ("str:%s len:%d i0:%d i1:%d i2:%d\n", str, strlen(str),i0,i1,i2);
/**Added by dhanya*/ if(!Feb_Control_AddModule1(i0,i1,i2,i2,1)){
if(i1 == 0){
/*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); printf("Error adding module, parameter was assigned twice in setup file: %s.\n",file_name);
exit(0); exit(0);
} }
}else{
/* 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++; //memaddress++;
Feb_Control_PrintModuleList(); Feb_Control_PrintModuleList();
@ -432,9 +417,9 @@ int Feb_Control_CheckModuleAddresses(struct Module* m){
} }
int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address){ int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address){
return Feb_Control_AddModule1(module_number,top_address,0,1); return Feb_Control_AddModule1(module_number,0,top_address,0,1);
} }
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 Feb_Control_AddModule1(unsigned int module_number, int bottom_enable, unsigned int top_address, unsigned int bottom_address, int half_module){ //bot_address 0 for half module
int parameters_ok = 1; int parameters_ok = 1;
unsigned int pre_module_index = 0; unsigned int pre_module_index = 0;
if(Feb_Control_GetModuleIndex(module_number,&pre_module_index)){ if(Feb_Control_GetModuleIndex(module_number,&pre_module_index)){
@ -452,7 +437,7 @@ int Feb_Control_AddModule1(unsigned int module_number, unsigned int top_address,
/* if((half_module)&& (top_address != 1)) Module_Module(m,module_number,top_address); /* if((half_module)&& (top_address != 1)) Module_Module(m,module_number,top_address);
else if(half_module) Module_ModuleBottom(m,module_number,top_address);*/ else if(half_module) Module_ModuleBottom(m,module_number,top_address);*/
if ((half_module)&& (!bottom_address)) Module_Module(m,module_number,top_address); if ((half_module)&& (!bottom_enable)) Module_Module(m,module_number,top_address);
else if (half_module) Module_ModuleBottom(m,module_number,bottom_address); else if (half_module) Module_ModuleBottom(m,module_number,bottom_address);
else Module_Module1(m,module_number,top_address,bottom_address); else Module_Module1(m,module_number,top_address,bottom_address);
@ -1100,6 +1085,7 @@ unsigned int Feb_Control_AddressToAll(){printf("in Feb_Control_AddressToAll()\n"
if(moduleSize==0) return 0; if(moduleSize==0) return 0;
/*
if(Module_BottomAddressIsValid(&modules[1])){ if(Module_BottomAddressIsValid(&modules[1])){
printf("************* bottom\n"); printf("************* bottom\n");
//if(Feb_Control_am_i_master) //if(Feb_Control_am_i_master)
@ -1107,9 +1093,10 @@ unsigned int Feb_Control_AddressToAll(){printf("in Feb_Control_AddressToAll()\n"
// else return 0; // else return 0;
} }
printf("************* top\n"); printf("************* top\n");
// if(Feb_Control_am_i_master) */
//return Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1]);
return Module_GetTopLeftAddress(&modules[0])|Module_GetTopRightAddress(&modules[0]); return Module_GetTopLeftAddress(&modules[0])|Module_GetTopRightAddress(&modules[0]);
// else return 0;
} }
@ -1165,7 +1152,12 @@ int Feb_Control_AcquisitionInProgress(){
}else{ }else{
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[ind]),&status_reg_r))) if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[ind]),&status_reg_r)))
{printf("ERROR: Trouble reading Status register. top right address\n");return 0;} {printf("ERROR: Trouble reading Status register. top right address\n");
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopRightAddress(&modules[0]),&status_reg_r)))
printf("ERROR: error with normal register\n");
else
printf("**********NO error reading normal register\n");
return 0;}
if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopLeftAddress(&modules[ind]),&status_reg_l))) if(!(Feb_Control_GetDAQStatusRegister(Module_GetTopLeftAddress(&modules[ind]),&status_reg_l)))
{printf("ERROR: Trouble reading Status register. top left address\n");return 0;} {printf("ERROR: Trouble reading Status register. top left address\n");return 0;}
} }
@ -1494,8 +1486,7 @@ int Feb_Control_WriteNRead(char* message, int length, int max_length){
} }
*/ */
int Feb_Control_StartAcquisition(){printf("****** starting acquisition********* \n"); int Feb_Control_PrepareForAcquisition(){//return 1;
static unsigned int reg_nums[20]; static unsigned int reg_nums[20];
static unsigned int reg_vals[20]; static unsigned int reg_vals[20];
@ -1531,37 +1522,87 @@ int Feb_Control_StartAcquisition(){printf("****** starting acquisition*********
reg_vals[2]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_time_in_sec); reg_vals[2]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_time_in_sec);
reg_nums[3]=DAQ_REG_EXPOSURE_REPEAT_TIMER; reg_nums[3]=DAQ_REG_EXPOSURE_REPEAT_TIMER;
reg_vals[3]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_period_in_sec); reg_vals[3]=Feb_Control_ConvertTimeToRegister(Feb_Control_exposure_period_in_sec);
///* reg_nums[4]=DAQ_REG_CHIP_CMDS;
if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),4,reg_nums,reg_vals,0,0)){ reg_vals[4]=(Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
// 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(),5,reg_nums,reg_vals,0,0)){
printf("Trouble starting acquisition....\n");; printf("Trouble starting acquisition....\n");;
return 0; return 0;
} }
//*/
/* if(!Feb_Control_am_i_master)
Feb_Control_StartAcquisition();*/
return 1;
}
int Feb_Control_StartAcquisition(){printf("****** starting acquisition********* \n");
static unsigned int reg_nums[20];
static unsigned int reg_vals[20];
/*
Feb_Control_PrintAcquisitionSetup();
// if(!Reset()||!ResetDataStream()){
if(!Feb_Control_Reset()){
printf("Trouble reseting daq or data stream...\n");;
return 0;
}
if(!Feb_Control_SetStaticBits1(Feb_Control_staticBits&(DAQ_STATIC_BIT_M4|DAQ_STATIC_BIT_M8))){
printf("Trouble setting static bits ...\n");;
return 0;
}
if(!Feb_Control_SendBitModeToBebServer()){
printf("Trouble sending static bits to server ...\n");;
return 0;
}
if(!Feb_Control_ResetChipCompletely()){
printf("Trouble resetting chips ...\n");;
return 0;
}
unsigned int masterHalfModuleMode = 0; reg_nums[0]=DAQ_REG_CTRL;
reg_vals[0]=0;
reg_nums[1]=DAQ_REG_NEXPOSURES;
reg_vals[1]=Feb_Control_nimages;
reg_nums[2]=DAQ_REG_EXPOSURE_TIMER;
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);
*/
/*
reg_nums[4]=DAQ_REG_CHIP_CMDS;
reg_vals[4]=(Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode);
*/
/*
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_nums[0]=DAQ_REG_CHIP_CMDS;
reg_vals[0]=(masterHalfModuleMode|Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode); 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)){ if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),1,reg_nums,reg_vals,0,0)){
printf("Trouble writing commands....\n");; printf("Trouble writing commands....\n");;
return 0; return 0;
} }
/*
masterHalfModuleMode = 0x80000000; masterHalfModuleMode = 0x80000000;
reg_nums[0]=DAQ_REG_CHIP_CMDS; reg_nums[0]=DAQ_REG_CHIP_CMDS;
reg_vals[0]=(masterHalfModuleMode|Feb_Control_acquireNReadoutMode|Feb_Control_triggerMode|Feb_Control_externalEnableMode|Feb_Control_subFrameMode); 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)){ if(!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),1,reg_nums,reg_vals,0,0)){
printf("Trouble writing commands....\n");; printf("Trouble writing commands....\n");;
return 0; return 0;
} }
*/
//if(!Feb_Interface_WriteRegisters((Module_GetTopLeftAddress(&modules[1])|Module_GetTopRightAddress(&modules[1])),1,reg_nums,reg_vals,0,0)){
///*
int i; int i;
for(i=0;i<14;i++){ for(i=0;i<14;i++){
reg_nums[i]=DAQ_REG_CTRL; reg_nums[i]=DAQ_REG_CTRL;
@ -1574,12 +1615,22 @@ int Feb_Control_StartAcquisition(){printf("****** starting acquisition*********
printf("Trouble starting acquisition....\n");; printf("Trouble starting acquisition....\n");;
return 0; return 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; int i;
for(i=5;i<19;i++){ for(i=5;i<19;i++){
reg_nums[i]=DAQ_REG_CTRL; reg_nums[i]=DAQ_REG_CTRL;
@ -1588,12 +1639,13 @@ int Feb_Control_StartAcquisition(){printf("****** starting acquisition*********
reg_nums[19]=DAQ_REG_CTRL; reg_nums[19]=DAQ_REG_CTRL;
reg_vals[19]=ACQ_CTRL_START; 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)){ if(!Feb_Interface_WriteRegisters(Feb_Control_AddressToAll(),20,reg_nums,reg_vals,0,0)){
printf("Trouble starting acquisition....\n");; printf("Trouble starting acquisition....\n");;
return 0; return 0;
} }
*/ */
//*/
return 1; return 1;
} }

View File

@ -77,7 +77,7 @@ void Feb_Control_Set_Master();
int Feb_Control_CheckModuleAddresses(struct Module* m); int Feb_Control_CheckModuleAddresses(struct Module* m);
int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address); int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address);
/*int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address, unsigned int bottom_address, int half_module=0);*/ /*int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address, unsigned int bottom_address, int half_module=0);*/
int Feb_Control_AddModule1(unsigned int module_number, unsigned int top_address, unsigned int bottom_address, int half_module); int Feb_Control_AddModule1(unsigned int module_number, int bottom_enable, unsigned int top_address, unsigned int bottom_address, int half_module);
int Feb_Control_GetDACNumber(char* s, unsigned int* n); int Feb_Control_GetDACNumber(char* s, unsigned int* n);
int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch, unsigned int* value); int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch, unsigned int* value);
@ -147,6 +147,8 @@ void Feb_Control_Set_Master();
int Feb_Control_Reset(); int Feb_Control_Reset();
int Feb_Control_PrepareForAcquisition();
int Feb_Control_StartAcquisition(); int Feb_Control_StartAcquisition();
int Feb_Control_StopAcquisition(); int Feb_Control_StopAcquisition();
int Feb_Control_AcquisitionInProgress(); int Feb_Control_AcquisitionInProgress();

View File

@ -33,7 +33,7 @@ Local_LocalLinkInterface1(struct LocalLinkInterface* ll,unsigned int ll_fifo_bad
Local_LocalLinkInterface(struct LocalLinkInterface* ll){ Local_LocalLinkInterface(struct LocalLinkInterface* ll){
printf("Initialize new memory\n"); printf("Initialize new memory\n");
} }
int Local_InitNewMemory (struct LocalLinkInterface* ll,unsigned int addr, int ifg){ int Local_InitNewMemory (struct LocalLinkInterface* ll,unsigned int addr, int ifg){
unsigned int CSP0BASE; unsigned int CSP0BASE;
@ -68,7 +68,7 @@ int Local_InitNewMemory (struct LocalLinkInterface* ll,unsigned int addr, int if
printf("ifg_control new=%02x\n",*ptr1); printf("ifg_control new=%02x\n",*ptr1);
close(fd); close(fd);
*/ */
return 1; return 1;
} }
@ -194,7 +194,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
buffer_ptr = 0; buffer_ptr = 0;
return -1; // buffer overflow return -1; // buffer overflow
} }
// printf(">>>> SOF\n\r"); // printf(">>>> SOF\n\r");
buffer_ptr = 0; buffer_ptr = 0;
sof = 1; sof = 1;
} }
@ -216,7 +216,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
if (status & PLB_LL_FIFO_STATUS_LL_EOF) if (status & PLB_LL_FIFO_STATUS_LL_EOF)
{ {
len = (buffer_ptr << 2) -3 + ( (status & PLB_LL_FIFO_STATUS_LL_REM)>>PLB_LL_FIFO_STATUS_LL_REM_SHIFT ); len = (buffer_ptr << 2) -3 + ( (status & PLB_LL_FIFO_STATUS_LL_REM)>>PLB_LL_FIFO_STATUS_LL_REM_SHIFT );
// printf(">>>>status=0x%08x EOF len = %d \n\r\n\r",status, len); // printf(">>>>status=0x%08x EOF len = %d \n\r\n\r",status, len);
buffer_ptr = 0; buffer_ptr = 0;
return len; return len;
} }
@ -234,9 +234,9 @@ int Local_ctrl_reg_write_mask(struct LocalLinkInterface* ll,unsigned int mask, u
ll->ll_fifo_ctrl_reg &= (~mask); ll->ll_fifo_ctrl_reg &= (~mask);
//printf("Fifo CTRL Reg(2): 0x%08x\n",plb_ll_fifo_ctrl_reg); //printf("Fifo CTRL Reg(2): 0x%08x\n",plb_ll_fifo_ctrl_reg);
ll->ll_fifo_ctrl_reg |= ( mask & val); ll->ll_fifo_ctrl_reg |= ( mask & val);
// printf("Fifo CTRL Reg: 0x%08x\n",plb_ll_fifo_ctrl_reg); // printf("Fifo CTRL Reg: 0x%08x\n",plb_ll_fifo_ctrl_reg);
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg); HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
// printf("Fifo STAT Reg: 0x%08x\n", plb_ll_fifo[PLB_LL_FIFO_REG_STATUS]); // printf("Fifo STAT Reg: 0x%08x\n", plb_ll_fifo[PLB_LL_FIFO_REG_STATUS]);
return 1; return 1;
} }

View File

@ -54,7 +54,8 @@ int default_dac_values[16] = {0,2000,2000,1250,700,1278,500,500,2000,500,500,550
enum masterFlags masterMode=NO_MASTER; enum masterFlags masterMode=NO_MASTER;
enum masterFlags trialMasterMode=NO_MASTER; int bottom = 0;
//enum masterFlags trialMasterMode=NO_MASTER;
int initDetector(){ int initDetector(){
int imod,i,n; int imod,i,n;
@ -137,20 +138,25 @@ int initDetector(){
Feb_Control_SetTestModeVariable(0); Feb_Control_SetTestModeVariable(0);
Feb_Control_CheckSetup(); Feb_Control_CheckSetup();
//if(!Feb_Control_IsBottomModule()){
//top or bottom
bottom = Feb_Control_IsBottomModule();
if(bottom)
printf("BOTTOM ***************\n");
else
printf("TOP ***************\n");
//if(getDetectorNumber()==0xbeb031){ //if(getDetectorNumber()==0xbeb031){
printf("************** master ********************\n"); // printf("************** master ********************\n");
trialMasterMode = IS_MASTER; // trialMasterMode = IS_MASTER;
Feb_Control_Set_Master(); //Feb_Control_Set_Master();
//} // }
//else printf("************** slave ********************\n"); //else printf("************** slave ********************\n");
if(Feb_Control_IsBottomModule())
printf("BOTTOM ***************\n");
else
printf("TOP ***************\n");
return 1; return 1;
} }
@ -469,38 +475,64 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
} }
int startReceiver(int d){
//if(trialMasterMode == IS_MASTER)
if(!bottom)
Feb_Control_PrepareForAcquisition();
return OK;
}
int startStateMachine(){ int startStateMachine(){
int ret; int ret;int i=0;
if(trialMasterMode == IS_MASTER){ //if(trialMasterMode == IS_MASTER){
if(!bottom){
printf("Going to start acquisition\n"); printf("Going to start acquisition\n");
Feb_Control_StartAcquisition(); Feb_Control_StartAcquisition();
} }
//if(trialMasterMode == IS_MASTER){ //do not read status here, cannot get images then
////if(trialMasterMode == IS_MASTER){
printf("requesting images\n"); printf("requesting images\n");
ret = startReadOut(); ret = startReadOut();
//} ////}
if(trialMasterMode == IS_MASTER){ //if(trialMasterMode == IS_MASTER){
/*for(i=0;i<3;i++) if(!bottom){
usleep(1000000);*/
while(getRunStatus() == IDLE); /*
printf("Acquiring..\n"); if(getRunStatus() == IDLE){
for(i=0;i<100000;i++){
usleep(1000);
if(getRunStatus() != IDLE){
printf("*****i=%d\n",i);
break;
} }
printf("Returning\n"); }
//while(getRunStatus() == IDLE);
//}
printf("*****Acquiring...\n");
}
*/
while(getRunStatus() == IDLE);
printf("*****Acquiring...\n");
}
printf("****Returning\n");
return ret; return ret;
} }
int stopStateMachine(){ int stopStateMachine(){
if(trialMasterMode == IS_MASTER){ //if(trialMasterMode == IS_MASTER){
printf("Going to stop acquisition\n"); printf("Going to stop acquisition\n");
if(Feb_Control_StopAcquisition()) if(Feb_Control_StopAcquisition())
return OK; return OK;
}else return OK; //}else return OK;
return FAIL; return FAIL;
} }
@ -529,16 +561,16 @@ int startReadOut(){
enum runStatus getRunStatus(){ enum runStatus getRunStatus(){
if(trialMasterMode == IS_MASTER){ //if(trialMasterMode == IS_MASTER){
int i = Feb_Control_AcquisitionInProgress(); int i = Feb_Control_AcquisitionInProgress();
if(i== 0){ if(i== 0){
//printf("IDLE\n"); //printf("IDLE\n");
return IDLE; return IDLE;
}else{ }else{
//printf("RUNNING\n"); printf("RUNNING\n");
return RUNNING; return RUNNING;
} }
} //}else printf("***** not master*** \n");
return IDLE; return IDLE;
} }
@ -548,7 +580,7 @@ enum runStatus getRunStatus(){
char *readFrame(int *ret, char *mess){ char *readFrame(int *ret, char *mess){
if(!Feb_Control_WaitForFinishedFlag(5000)) if(!Feb_Control_WaitForFinishedFlag(5000))
printf("error in waiting for finished flag\n"); printf("error in waiting for finished flag\n");
printf("acquisition finished\n"); printf("Acquisition finished\n");
*ret = (int)FINISHED; *ret = (int)FINISHED;
return NULL; return NULL;

View File

@ -1,4 +1,11 @@
/* ONLY THOSE ARE USED IN THIS SOFTWARE. If one of those is modified in xilinx compilation, this file should be replaced with updated values
XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR
XPAR_PLB_LL_FIFO_AURORA_RX4_TX1_RIGHT_BASEADDR
XPAR_PLB_LL_FIFO_AURORA_RX4_TX1_LEFT_BASEADDR
XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR
XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR
XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR
*/
/******************************************************************* /*******************************************************************
* *
* CAUTION: This file is automatically generated by libgen. * CAUTION: This file is automatically generated by libgen.

View File

@ -1496,6 +1496,8 @@ int multiSlsDetector::startAndReadAllNoWait(){
ret1=FAIL; ret1=FAIL;
} }
} }
i=thisMultiDetector->masterPosition; i=thisMultiDetector->masterPosition;
if (thisMultiDetector->masterPosition>=0) { if (thisMultiDetector->masterPosition>=0) {
if (detectors[i]) { if (detectors[i]) {

View File

@ -6190,7 +6190,7 @@ int slsDetector::startReceiver(){
setErrorMask((getErrorMask())|(COULDNOT_START_RECEIVER)); setErrorMask((getErrorMask())|(COULDNOT_START_RECEIVER));
} }
} }
if((ret==OK)&& (thisDetector->myDetectorType != EIGER)) if((ret==OK))//&& (thisDetector->myDetectorType != EIGER))
ret=detectorSendToReceiver(true); ret=detectorSendToReceiver(true);
return ret; return ret;

View File

@ -107,6 +107,8 @@ int calibratePedestal(int frames);
#endif #endif
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod); int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod);
int calculateDataBytes(); int calculateDataBytes();
@ -127,6 +129,7 @@ enum masterFlags setMaster(enum masterFlags arg);
enum synchronizationMode setSynchronization(enum synchronizationMode arg); enum synchronizationMode setSynchronization(enum synchronizationMode arg);
#ifdef EIGERD #ifdef EIGERD
int startReceiver(int d);
void setExternalGating(int enable[]); void setExternalGating(int enable[]);
void setAllTrimbits(int val); void setAllTrimbits(int val);
int getAllTrimbits(); int getAllTrimbits();

View File

@ -2278,9 +2278,9 @@ int get_run_status(int file_des) {
#ifdef VERBOSE #ifdef VERBOSE
printf("Getting status\n"); printf("Getting status\n");
#endif #endif
#ifdef SLS_DETECTOR_FUNCTION_LIST //#ifdef SLS_DETECTOR_FUNCTION_LIST
s= getRunStatus();printf("status:%d\n"); s= getRunStatus();printf("status:%x\n",s);
#endif //#endif
if (ret!=OK) { if (ret!=OK) {
printf("get status failed\n"); printf("get status failed\n");
@ -3269,10 +3269,7 @@ int start_receiver(int file_des) {
strcpy(mess,"Could not start receiver\n"); strcpy(mess,"Could not start receiver\n");
/* execute action if the arguments correctly arri ved*/ /* execute action if the arguments correctly arri ved*/
#ifndef GOTTHARDD #if defined(GOTTHARDD) || defined(EIGERD)
ret = FAIL;
strcpy(mess,"Not applicable/implemented for this detector\n");
#else
#ifdef SLS_DETECTOR_FUNCTION_LIST #ifdef SLS_DETECTOR_FUNCTION_LIST
if (lockStatus==1 && differentClients==1){//necessary??? if (lockStatus==1 && differentClients==1){//necessary???
sprintf(mess,"Detector locked by %s\n", lastClientIP); sprintf(mess,"Detector locked by %s\n", lastClientIP);
@ -3282,6 +3279,9 @@ int start_receiver(int file_des) {
ret = startReceiver(1); ret = startReceiver(1);
#endif #endif
#else
ret = FAIL;
strcpy(mess,"Not applicable/implemented for this detector\n");
#endif #endif
if(ret==OK && differentClients){ if(ret==OK && differentClients){